<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="et">
	<id>http://www.lambda.ee/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Riina</id>
	<title>Lambda - Kasutaja kaastöö [et]</title>
	<link rel="self" type="application/atom+xml" href="http://www.lambda.ee/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Riina"/>
	<link rel="alternate" type="text/html" href="http://www.lambda.ee/wiki/Eri:Kaast%C3%B6%C3%B6/Riina"/>
	<updated>2026-10-28T15:20:45Z</updated>
	<subtitle>Kasutaja kaastöö</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22955</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22955"/>
		<updated>2026-05-04T08:06:58Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Practical work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2025|2025]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! Kolmas kodutöö uuendatud&amp;lt;/font&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
Vaata allpool &amp;quot;Third lab: questions in NLP&amp;quot;: see on uuendatud 2026 aasta jaoks. Idee on analoogiline eelmise aasta ülesandega, aga konkretiseeritud piltide ülesandega (esimese ja teise kodutöö teemad) sobivaks.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! 23 ja 24 veebruar on puhkepäevad&amp;lt;/font&amp;gt; =&lt;br /&gt;
Esmaspäev, 23. veebruar (ja ka teisipäev, 24. veebruar) on ülikoolis puhkepäevad ja õppetööd ei toimu.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! Materjalid hetkel uuendamisel&amp;lt;/font&amp;gt; =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Mondays 12:00-13:30 room SOC 414&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Tuesdays 08:00-09:30 room &amp;lt;s&amp;gt;MEK-122&amp;lt;/s&amp;gt; MEK-109.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3A-xXLRsURTirXcCCkQN46w4wYRJaarxbl797KeThtWXY1%40thread.tacv2/conversations?groupId=30b97413-f1b1-404d-8498-b35024d1a002&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams group] of the course. The code for joining is zb3z457.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/33688408323196?p=sd6YBPK9VZ7gRe7Zro teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/3558703223396?p=zc4Lgecwoy1e9Yhav9 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam (10 of these on the page), while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials (20 on the page) will also come up, but less and/or in a simpler form. &lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
== The first weekly task ==&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 17. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjalile [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
client table: id name balance&lt;br /&gt;
1 john 100 &lt;br /&gt;
2 pete -200&lt;br /&gt;
&lt;br /&gt;
cars table: id model owner&lt;br /&gt;
1 ford 1&lt;br /&gt;
2 opel 2&lt;br /&gt;
3 saab 2&lt;br /&gt;
&lt;br /&gt;
select client.name, client.balance&lt;br /&gt;
from client where balance&amp;lt;0&lt;br /&gt;
&lt;br /&gt;
select client.name, cars.model from client, cars&lt;br /&gt;
where client.id=cars.owner&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
* Kasuta kindlasti oma taltech.ee aadressi, sest muidu võib kiri lõpetada rämpspostis!&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The second weekly task ==&lt;br /&gt;
&lt;br /&gt;
Selle ülesande mõte on veidi praktiseerida JSON-LD esitusega. Sinu konkreetne ülesanne on võtta oma esimene nädalaülesanne ja esitada needsamad andmed (ja soovitavalt ka reeglid) JSON-LD kujul.&lt;br /&gt;
&lt;br /&gt;
Vaata alustuseks json-ld näiteid [https://logictools.org/json.html logictoolsi json-tabi alt]. NB! Enamus näiteid &amp;quot;example&amp;quot; valikuboksist ei ole konventsionaalne json-ld, aga mitmed on.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
* Kasuta saatmiseks kindlasti taltech.ee aadressi, sest muidu võib kiri minna rämpspostiks!&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2026 homework part 1|2026 task for the first lab]] is about encoding nontrivial information in various ways (standard logic, rdf, json-ld) and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Deadline: 10. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2026 homework part 2|2026 task for the second lab]] is about using a VLM (visual language model) to get a structured description from an image which would fit with the pre-existing simple world model.&lt;br /&gt;
&lt;br /&gt;
Deadline: 7. April&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
This is the task for 2026:&lt;br /&gt;
&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner for images: 2026]] &lt;br /&gt;
&lt;br /&gt;
Deadline: 12. May&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- We will do live experimenting for the third lab at the April 22 lecture and will then add more interesting parts to the notes above. --&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
NB! The task description above has just been updated (at 13. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin. &amp;lt;!-- [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) --&amp;gt; [https://web.stanford.edu/~jurafsky/slp3/ the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read [https://web.stanford.edu/~jurafsky/slp3/20.pdf chapter 6 about extracting information] and the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/H.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture] --&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2025 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 2. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2026.pdf|teadmised_intro2026.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel] &amp;lt;!--, [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel] --&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 9. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl + reasoner: 16. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
What the reasoner does:&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: DPP ontology development. 2. March ===&lt;br /&gt;
&lt;br /&gt;
Loengu annab Riina. Digital Product Passport (DPP)&lt;br /&gt;
kui näide praktilisest ontoloogia/sõnastiku arendamisest [https://cirpassproject.eu/dpp-in-a-nutshell/ CIRPASS] projektis.&lt;br /&gt;
&lt;br /&gt;
[https://dpp.vocabulary-hub.eu/ Hetkeseisu algusleht]. &lt;br /&gt;
&lt;br /&gt;
[https://cirpass2.eu/ CIRPASS-2]&lt;br /&gt;
&lt;br /&gt;
[https://si-digital-framework.org/SI/units?lang=en Ühikute ontoloogia]&lt;br /&gt;
&lt;br /&gt;
[https://www.w3.org/TR/shacl/ SHACL]&lt;br /&gt;
&lt;br /&gt;
[https://untp.unece.org/docs/specification/DigitalProductPassport/ UNTP DPP]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: märtsi algul ===&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Next homework and looking into main large knowledge bases: 9. March  ===&lt;br /&gt;
&lt;br /&gt;
We will first present the next homework.&lt;br /&gt;
&lt;br /&gt;
Then we will continue with existing large knowledge bases.&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors: 16 March ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variant]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; ja siis [https://web.stanford.edu/~jurafsky/slp3/5.pdf chapter 5: Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vaata [https://web.stanford.edu/~jurafsky/slp3/ sisukorrast] ka slaide nende kohta.&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM) 23 March ===&lt;br /&gt;
&lt;br /&gt;
* [[Media:Llm_intro_2026.pdf|Lecture material part 1]]&lt;br /&gt;
* [[Media:Llm_details_2026.pdf|Lecture material part 2]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: RAG usage pattern / context engineering for LLMs : 30 March ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]: this is focused on RAG and written in 2024 and spring 2025: good tool use, good reasoning and more autonomy like claude code and openclaw are not covered in this overview. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;quot;Context Engineering&amp;quot;&amp;lt;/b&amp;gt; became a popular phrase in 2025: essentially it means &amp;quot;fancy RAG&amp;quot;, i.e. significant effort put towards creating a really good set of additional information (prompt additions: &amp;quot;context&amp;quot;) for each user query/prompt. It can also mean approaches for storing such additional information on the fly in special files which&lt;br /&gt;
are then used RAG-like as extra input in addition to user dialog.For example, claude code [https://code.claude.com/docs/en/memory memory principles] and [https://blog.dailydoseofds.com/p/anatomy-of-the-claude-folder memory folder structure], openclaw [https://lumadock.com/tutorials/openclaw-memory-explained memory].&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
&amp;lt;!-- * early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use] --&amp;gt;&lt;br /&gt;
* RAG focus: [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* Old finetuning example: [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- ** [https://getalign.com/ example estonian startup using a kind of rag] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: issues in formalizing commonsense reasoning: open/closed world, frame problem, uncertainties: 6. April ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&amp;lt;i&amp;gt;First, some results/challenges in neurosymbolic reasoning.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]&lt;br /&gt;
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]&lt;br /&gt;
* [https://arcprize.org/ arcprize]. See also [https://liusida.github.io/ARC/ ARC v1 for humans], [https://www.youtube.com/watch?v=jSAT_RuJ_Cg MLST about the state of v1 solvers], [https://www.youtube.com/watch?v=M3b59lZYBW8 MLST video introducing ARC v2]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;First, open/closed world, world states, frame problem&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the &amp;lt;i&amp;gt;open world assumption&amp;lt;/i&amp;gt;: if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there. The simplest way to experiment is to use https://logictools.org/ . There is already a &amp;lt;b&amp;gt;blocks world&amp;lt;/b&amp;gt; example available.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Second, uncertainty&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links. In particular, [https://en.wikipedia.org/wiki/Bayesian_inference Wiki on Bayesian inference] and [https://math.mit.edu/~dav/05.dir/class11-prep.pdf this]&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: research in neurosymbolic reasoning: 13 April ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Research_in_Neurosymbolic_Reasoning.pdf|lecture slides]]&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our PhD student [https://aire-edih.eu/meeskond/otto-mattas/ Otto Mättas].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: semantic parsing with LLMs and with UDP: 20 April ===&lt;br /&gt;
&lt;br /&gt;
The focus of the lecture is on [https://en.wikipedia.org/wiki/Semantic_parsing semantic parsing].&lt;br /&gt;
&lt;br /&gt;
For a quick intro we will use Martin&#039;s slides from 2024 [[Media:KR_2024_Parsing_01.pdf|semantic parsing]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The rest of the lecture will explain stuff in [https://github.com/tammet/nlpsolver nlpsolver]. See the [[Media:Nlpsolver_presentation.pdf|nlpsolver presentation]].&lt;br /&gt;
&lt;br /&gt;
Useful background:&lt;br /&gt;
&lt;br /&gt;
About important concepts in parsing:&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Part_of_speech Part-Of-Speech (POS)] and [https://en.wikipedia.org/wiki/Part-of-speech_tagging POS tagging]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/18.pdf Jurafsky&amp;amp;Martin: Constituency Parsing]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/19.pdf Jurafsky&amp;amp;Martin: Dependency Parsing]&lt;br /&gt;
&lt;br /&gt;
Some important toolkits and representation schemes:&lt;br /&gt;
* [https://spacy.io spacy], [[a small spacy UD parsing example]]&lt;br /&gt;
* [https://stanfordnlp.github.io/stanza/ stanza]&lt;br /&gt;
* [https://universaldependencies.org/ universal dependencies]&lt;br /&gt;
&lt;br /&gt;
Some draft parsing papers:&lt;br /&gt;
* [[Media:concepts_draft_paper.pdf|concepts, based on UD]]&lt;br /&gt;
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]&lt;br /&gt;
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: we explore some recent papers in neurosymbolic reasoning: 27 April  ===&lt;br /&gt;
&lt;br /&gt;
A reading session: we will read and attempt to understand together some case studies. &lt;br /&gt;
&lt;br /&gt;
* Google DeepMind paper [https://www.nature.com/articles/s41586-023-06747-5 Solving olympiad geometry without human demonstrations]&lt;br /&gt;
* Google DeepMind paper [https://www.nature.com/articles/s41586-025-09833-y Olympiad-level formal mathematical reasoning with reinforcement learning]&lt;br /&gt;
* [https://arxiv.org/abs/2502.13834 Proving Olympiad Inequalities by Synergizing LLMs and Symbolic Reasoning]&lt;br /&gt;
* [https://arxiv.org/abs/2511.11751 Concept-RuleNet: Grounded Multi-Agent Neurosymbolic Reasoning in Vision Language Models]&lt;br /&gt;
* [https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf What’s Left?Concept Grounding with Logic-Enhanced Foundation Models]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: visual reasoning: 4. May  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher [https://vaishnavmohit.github.io/ Mohit Vaishnav]. &lt;br /&gt;
&lt;br /&gt;
[[Media:Visual Reasoning 2026.pdf|Lecture presentation]]&lt;br /&gt;
&lt;br /&gt;
Related preprints: &lt;br /&gt;
* [https://arxiv.org/pdf/2501.13620 Cognitive paradigms for evaluating vlms on visual reasoning task]&lt;br /&gt;
* [https://arxiv.org/pdf/2604.21346 Symbolic Grounding Reveals Representational Bottlenecks in Abstract Visual Reasoning]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: we continue exploring recent papers in neurosymbolic reasoning: 11 May  ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Consultation for the exam: 18 May  ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Media:Research_in_Neurosymbolic_Reasoning.pdf|lecture slides]]&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our PhD student [https://aire-edih.eu/meeskond/otto-mattas/ Otto Mättas].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: visual reasoning  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher Mohit Vaishnav. You may want to have a look at his [https://vaishnavmohit.github.io/phd_thesis/ thesis] from 2023.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: third lab live experiments ===&lt;br /&gt;
&lt;br /&gt;
We will do live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
Previous plan was: continue with uncertainty, numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Semantic parsing  ===&lt;br /&gt;
&lt;br /&gt;
The focus of the lecture is on [https://en.wikipedia.org/wiki/Semantic_parsing semantic parsing].&lt;br /&gt;
&lt;br /&gt;
Here are Martin&#039;s slides from 2024 [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
We will look at both (a) classic paradigms of semantic parsing (as on the slides), (b) using LLMs and alternative modern paradigms for semantic parsing.&lt;br /&gt;
&lt;br /&gt;
About important concepts in parsing:&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Part_of_speech Part-Of-Speech (POS)] and [https://en.wikipedia.org/wiki/Part-of-speech_tagging POS tagging]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/18.pdf Jurafsky&amp;amp;Martin: Constituency Parsing]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/19.pdf Jurafsky&amp;amp;Martin: Dependency Parsing]&lt;br /&gt;
&lt;br /&gt;
Some important toolkits and representation schemes:&lt;br /&gt;
* [https://spacy.io spacy], [[a small spacy UD parsing example]]&lt;br /&gt;
* [https://stanfordnlp.github.io/stanza/ stanza]&lt;br /&gt;
* [https://universaldependencies.org/ universal dependencies]&lt;br /&gt;
&lt;br /&gt;
Some draft parsing papers:&lt;br /&gt;
* [[Media:concepts_draft_paper.pdf|concepts, based on UD]]&lt;br /&gt;
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]&lt;br /&gt;
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Semantic parsing continued  ===&lt;br /&gt;
&lt;br /&gt;
Lecture will be given by Martin Verrev on teams only (not the lecture room).&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Topics in neurosymbolic reasoning and consultation for the exam  ===&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22932</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22932"/>
		<updated>2026-04-20T06:23:00Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Third lab: questions in NLP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2025|2025]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! Kolmas kodutöö uuendatud&amp;lt;/font&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
Vaata allpool &amp;quot;Third lab: questions in NLP&amp;quot;: see on uuendatud 2026 aasta jaoks. Idee on analoogiline eelmise aasta ülesandega, aga konkretiseeritud piltide ülesandega (esimese ja teise kodutöö teemad) sobivaks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! 23 ja 24 veebruar on puhkepäevad&amp;lt;/font&amp;gt; =&lt;br /&gt;
Esmaspäev, 23. veebruar (ja ka teisipäev, 24. veebruar) on ülikoolis puhkepäevad ja õppetööd ei toimu.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! Materjalid hetkel uuendamisel&amp;lt;/font&amp;gt; =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Mondays 12:00-13:30 room SOC 414&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Tuesdays 08:00-09:30 room &amp;lt;s&amp;gt;MEK-122&amp;lt;/s&amp;gt; MEK-109.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3A-xXLRsURTirXcCCkQN46w4wYRJaarxbl797KeThtWXY1%40thread.tacv2/conversations?groupId=30b97413-f1b1-404d-8498-b35024d1a002&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams group] of the course. The code for joining is zb3z457.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/33688408323196?p=sd6YBPK9VZ7gRe7Zro teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/3558703223396?p=zc4Lgecwoy1e9Yhav9 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam (10 of these on the page), while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials (20 on the page) will also come up, but less and/or in a simpler form. &lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
== The first weekly task ==&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 17. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjalile [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
client table: id name balance&lt;br /&gt;
1 john 100 &lt;br /&gt;
2 pete -200&lt;br /&gt;
&lt;br /&gt;
cars table: id model owner&lt;br /&gt;
1 ford 1&lt;br /&gt;
2 opel 2&lt;br /&gt;
3 saab 2&lt;br /&gt;
&lt;br /&gt;
select client.name, client.balance&lt;br /&gt;
from client where balance&amp;lt;0&lt;br /&gt;
&lt;br /&gt;
select client.name, cars.model from client, cars&lt;br /&gt;
where client.id=cars.owner&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
* Kasuta kindlasti oma taltech.ee aadressi, sest muidu võib kiri lõpetada rämpspostis!&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The second weekly task ==&lt;br /&gt;
&lt;br /&gt;
Selle ülesande mõte on veidi praktiseerida JSON-LD esitusega. Sinu konkreetne ülesanne on võtta oma esimene nädalaülesanne ja esitada needsamad andmed (ja soovitavalt ka reeglid) JSON-LD kujul.&lt;br /&gt;
&lt;br /&gt;
Vaata alustuseks json-ld näiteid [https://logictools.org/json.html logictoolsi json-tabi alt]. NB! Enamus näiteid &amp;quot;example&amp;quot; valikuboksist ei ole konventsionaalne json-ld, aga mitmed on.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
* Kasuta saatmiseks kindlasti taltech.ee aadressi, sest muidu võib kiri minna rämpspostiks!&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; The plan for practice work is currently being updated. The information below is not up to date yet, except for the first lab, which is already updated for 2026.&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2026 homework part 1|2026 task for the first lab]] is about encoding nontrivial information in various ways (standard logic, rdf, json-ld) and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Deadline: 10. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2026 homework part 2|2026 task for the second lab]] is about using a VLM (visual language model) to get a structured description from an image which would fit with the pre-existing simple world model.&lt;br /&gt;
&lt;br /&gt;
Deadline: 7. April&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
This is the task for 2026:&lt;br /&gt;
&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner for images: 2026]] &lt;br /&gt;
&lt;br /&gt;
Deadline: 12. May&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- We will do live experimenting for the third lab at the April 22 lecture and will then add more interesting parts to the notes above. --&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
NB! The task description above has just been updated (at 13. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin. &amp;lt;!-- [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) --&amp;gt; [https://web.stanford.edu/~jurafsky/slp3/ the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read [https://web.stanford.edu/~jurafsky/slp3/20.pdf chapter 6 about extracting information] and the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/H.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture] --&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2025 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 2. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2026.pdf|teadmised_intro2026.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel] &amp;lt;!--, [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel] --&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 9. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl + reasoner: 16. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
What the reasoner does:&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: DPP ontology development. 2. March ===&lt;br /&gt;
&lt;br /&gt;
Loengu annab Riina. Digital Product Passport (DPP)&lt;br /&gt;
kui näide praktilisest ontoloogia/sõnastiku arendamisest [https://cirpassproject.eu/dpp-in-a-nutshell/ CIRPASS] projektis.&lt;br /&gt;
&lt;br /&gt;
[https://dpp.vocabulary-hub.eu/ Hetkeseisu algusleht]. &lt;br /&gt;
&lt;br /&gt;
[https://cirpass2.eu/ CIRPASS-2]&lt;br /&gt;
&lt;br /&gt;
[https://si-digital-framework.org/SI/units?lang=en Ühikute ontoloogia]&lt;br /&gt;
&lt;br /&gt;
[https://www.w3.org/TR/shacl/ SHACL]&lt;br /&gt;
&lt;br /&gt;
[https://untp.unece.org/docs/specification/DigitalProductPassport/ UNTP DPP]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: märtsi algul ===&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Next homework and looking into main large knowledge bases: 9. March  ===&lt;br /&gt;
&lt;br /&gt;
We will first present the next homework.&lt;br /&gt;
&lt;br /&gt;
Then we will continue with existing large knowledge bases.&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors: 16 March ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variant]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; ja siis [https://web.stanford.edu/~jurafsky/slp3/5.pdf chapter 5: Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vaata [https://web.stanford.edu/~jurafsky/slp3/ sisukorrast] ka slaide nende kohta.&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM) 23 March ===&lt;br /&gt;
&lt;br /&gt;
* [[Media:Llm_intro_2026.pdf|Lecture material part 1]]&lt;br /&gt;
* [[Media:Llm_details_2026.pdf|Lecture material part 2]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: RAG usage pattern / context engineering for LLMs : 30 March ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]: this is focused on RAG and written in 2024 and spring 2025: good tool use, good reasoning and more autonomy like claude code and openclaw are not covered in this overview. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;quot;Context Engineering&amp;quot;&amp;lt;/b&amp;gt; became a popular phrase in 2025: essentially it means &amp;quot;fancy RAG&amp;quot;, i.e. significant effort put towards creating a really good set of additional information (prompt additions: &amp;quot;context&amp;quot;) for each user query/prompt. It can also mean approaches for storing such additional information on the fly in special files which&lt;br /&gt;
are then used RAG-like as extra input in addition to user dialog.For example, claude code [https://code.claude.com/docs/en/memory memory principles] and [https://blog.dailydoseofds.com/p/anatomy-of-the-claude-folder memory folder structure], openclaw [https://lumadock.com/tutorials/openclaw-memory-explained memory].&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
&amp;lt;!-- * early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use] --&amp;gt;&lt;br /&gt;
* RAG focus: [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* Old finetuning example: [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!-- ** [https://getalign.com/ example estonian startup using a kind of rag] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: issues in formalizing commonsense reasoning: open/closed world, frame problem, uncertainties: 6. April ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&amp;lt;i&amp;gt;First, some results/challenges in neurosymbolic reasoning.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]&lt;br /&gt;
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]&lt;br /&gt;
* [https://arcprize.org/ arcprize]. See also [https://liusida.github.io/ARC/ ARC v1 for humans], [https://www.youtube.com/watch?v=jSAT_RuJ_Cg MLST about the state of v1 solvers], [https://www.youtube.com/watch?v=M3b59lZYBW8 MLST video introducing ARC v2]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;First, open/closed world, world states, frame problem&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the &amp;lt;i&amp;gt;open world assumption&amp;lt;/i&amp;gt;: if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there. The simplest way to experiment is to use https://logictools.org/ . There is already a &amp;lt;b&amp;gt;blocks world&amp;lt;/b&amp;gt; example available.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Second, uncertainty&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links. In particular, [https://en.wikipedia.org/wiki/Bayesian_inference Wiki on Bayesian inference] and [https://math.mit.edu/~dav/05.dir/class11-prep.pdf this]&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: research in neurosymbolic reasoning: 13 April ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Research_in_Neurosymbolic_Reasoning.pdf|lecture slides]]&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our PhD student [https://aire-edih.eu/meeskond/otto-mattas/ Otto Mättas].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: semantic parsing with LLMs and with UDP: 20 April ===&lt;br /&gt;
&lt;br /&gt;
The focus of the lecture is on [https://en.wikipedia.org/wiki/Semantic_parsing semantic parsing].&lt;br /&gt;
&lt;br /&gt;
For a quick intro we will use Martin&#039;s slides from 2024 [[Media:KR_2024_Parsing_01.pdf|semantic parsing]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The rest of the lecture will explain stuff in [https://github.com/tammet/nlpsolver nlpsolver]. See the [[Media:Nlpsolver_presentation.pdf|nlpsolver presentation]].&lt;br /&gt;
&lt;br /&gt;
Useful background:&lt;br /&gt;
&lt;br /&gt;
About important concepts in parsing:&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Part_of_speech Part-Of-Speech (POS)] and [https://en.wikipedia.org/wiki/Part-of-speech_tagging POS tagging]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/18.pdf Jurafsky&amp;amp;Martin: Constituency Parsing]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/19.pdf Jurafsky&amp;amp;Martin: Dependency Parsing]&lt;br /&gt;
&lt;br /&gt;
Some important toolkits and representation schemes:&lt;br /&gt;
* [https://spacy.io spacy], [[a small spacy UD parsing example]]&lt;br /&gt;
* [https://stanfordnlp.github.io/stanza/ stanza]&lt;br /&gt;
* [https://universaldependencies.org/ universal dependencies]&lt;br /&gt;
&lt;br /&gt;
Some draft parsing papers:&lt;br /&gt;
* [[Media:concepts_draft_paper.pdf|concepts, based on UD]]&lt;br /&gt;
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]&lt;br /&gt;
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: visual reasoning: 27 April  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher Mohit Vaishnav. You may want to have a look at his [https://vaishnavmohit.github.io/phd_thesis/ thesis] from 2023.&lt;br /&gt;
&lt;br /&gt;
Related preprint: [https://arxiv.org/pdf/2501.13620 Cognitive paradigms for evaluating vlms on visual reasoning task]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: we explore some recent papers in neurosymbolic reasoning: 4 May  ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: we continue exploring recent papers in neurosymbolic reasoning: 11 May  ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Consultation for the exam: 18 May  ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[[Media:Research_in_Neurosymbolic_Reasoning.pdf|lecture slides]]&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our PhD student [https://aire-edih.eu/meeskond/otto-mattas/ Otto Mättas].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: visual reasoning  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher Mohit Vaishnav. You may want to have a look at his [https://vaishnavmohit.github.io/phd_thesis/ thesis] from 2023.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: third lab live experiments ===&lt;br /&gt;
&lt;br /&gt;
We will do live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
Previous plan was: continue with uncertainty, numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Semantic parsing  ===&lt;br /&gt;
&lt;br /&gt;
The focus of the lecture is on [https://en.wikipedia.org/wiki/Semantic_parsing semantic parsing].&lt;br /&gt;
&lt;br /&gt;
Here are Martin&#039;s slides from 2024 [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
We will look at both (a) classic paradigms of semantic parsing (as on the slides), (b) using LLMs and alternative modern paradigms for semantic parsing.&lt;br /&gt;
&lt;br /&gt;
About important concepts in parsing:&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Part_of_speech Part-Of-Speech (POS)] and [https://en.wikipedia.org/wiki/Part-of-speech_tagging POS tagging]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/18.pdf Jurafsky&amp;amp;Martin: Constituency Parsing]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/19.pdf Jurafsky&amp;amp;Martin: Dependency Parsing]&lt;br /&gt;
&lt;br /&gt;
Some important toolkits and representation schemes:&lt;br /&gt;
* [https://spacy.io spacy], [[a small spacy UD parsing example]]&lt;br /&gt;
* [https://stanfordnlp.github.io/stanza/ stanza]&lt;br /&gt;
* [https://universaldependencies.org/ universal dependencies]&lt;br /&gt;
&lt;br /&gt;
Some draft parsing papers:&lt;br /&gt;
* [[Media:concepts_draft_paper.pdf|concepts, based on UD]]&lt;br /&gt;
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]&lt;br /&gt;
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Semantic parsing continued  ===&lt;br /&gt;
&lt;br /&gt;
Lecture will be given by Martin Verrev on teams only (not the lecture room).&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Topics in neurosymbolic reasoning and consultation for the exam  ===&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=KR_2026_homework_part_2&amp;diff=22817</id>
		<title>KR 2026 homework part 2</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=KR_2026_homework_part_2&amp;diff=22817"/>
		<updated>2026-03-27T13:02:00Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Gemini API */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This lab is primarily an exploration in prompt engineering a VLM to create structured representations.&lt;br /&gt;
&lt;br /&gt;
== Task ==&lt;br /&gt;
&lt;br /&gt;
You will have to write a small system where a VLM ([https://en.wikipedia.org/wiki/Vision-language_model vision language model]: most large commercial LLMs are actually VLMs) describes the contents of an ordinary room, using the same schema and principles you used yourself for the the first lab. The main part of the work is prompt engineering for a VLM to do a sensibly good job.  &lt;br /&gt;
&lt;br /&gt;
Your system should be able to automatically generate a significant portion of the data you yourself wrote in the first lab by looking at an image, by looking at the same image. It should also be able to generate a noticeable amount of sensible structured data about an image for other, similar images of rooms. &lt;br /&gt;
&lt;br /&gt;
Crucially, your system should use the same principles / schema of knowledge representation you used yourself in the first lab. The logical reasoning you could do in the first lab should also be doable with the output of your system. The concrete choice of a representation language (json-ld or not) is up to you. No need to generate the knowledge in several representation languages.&lt;br /&gt;
&lt;br /&gt;
You have to present at least three images of a room (including the one used in the first lab) along with the output of system. For the image from the first lab, compare the data written by you to the data created by your system.&lt;br /&gt;
&lt;br /&gt;
== Initial ideas and suggestions ==&lt;br /&gt;
&lt;br /&gt;
The system could either:&lt;br /&gt;
* Ask the VLM to produce the structured information using your schema/encoding directly, or&lt;br /&gt;
* First ask the VLM to produce an intermediate representation and then convert the intermediate representation either programmatically or using an LLM to a suitable final representation. Here there are again several options:&lt;br /&gt;
** Let VLM produce an English representation and then use an LLM to convert it to a final representation.&lt;br /&gt;
** Let VLM produce some structured JSON not directly in the final format, and then programmatically (or with an LLM) convert to the final representation.&lt;br /&gt;
&lt;br /&gt;
Explore yourself which way works best for you. It is probably easier to start with the first, direct approach.&lt;br /&gt;
&lt;br /&gt;
=== Some tips about prompt engineering ===&lt;br /&gt;
&lt;br /&gt;
Create a prompt which is a balanced mixture of instructions and examples.&lt;br /&gt;
&lt;br /&gt;
The instructions should describe the task and the expected encoding. Give a nomenclature of predicates and explain how to represent what. Give several examples of room descriptions in the expected encoding. You can also give negative examples: output which is not OK.&lt;br /&gt;
&lt;br /&gt;
Importantly, give several examples of actual images along with the expected description in the expected encoding.&lt;br /&gt;
&lt;br /&gt;
NB! Do not use the same images / descriptions as in the prompt in your three demonstration image/description cases.&lt;br /&gt;
&lt;br /&gt;
=== Some tips about writing code ===&lt;br /&gt;
&lt;br /&gt;
First, it is highly recommended to use a VLM API for the task, not a web-based chat window (you cannot well write a system around a chat window). Look up the APIs. They may want you to use a credit card, although there are free ones available. The actual cost is going to be micoscopic, since you are not going to perform massive amounts of large API calls.&lt;br /&gt;
&lt;br /&gt;
Look up the API pages of large LLM providers. Most probably you can use the free tier of Gemini: https://ai.google.dev/gemini-api/docs/pricing&lt;br /&gt;
&lt;br /&gt;
When writing code, prefer doing it in a dialog with an LLM. Since the task is small, you can probably just use a chat window to describe the task, bring examples, get and debug the code. It is surely a bit better to use a proper coding tool like Claude code or VS Code plugin etc for the task, but it will be perfectly OK with just a chat window as well.&lt;br /&gt;
&lt;br /&gt;
=== Gemini API ===&lt;br /&gt;
&lt;br /&gt;
Gemini documentation examples about how to handle inline images: https://ai.google.dev/gemini-api/docs/image-understanding&lt;br /&gt;
&lt;br /&gt;
You can generate your API key in here: https://aistudio.google.com/&lt;br /&gt;
&lt;br /&gt;
Below is a simple starter code generated by Gemini shown in practice session. Recommendation is to &amp;lt;b&amp;gt;not&amp;lt;/b&amp;gt; use this code, but instead generate/write your own from scratch.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env python3&lt;br /&gt;
&lt;br /&gt;
import os&lt;br /&gt;
from google import genai&lt;br /&gt;
from PIL import Image&lt;br /&gt;
&lt;br /&gt;
def analyze_image_with_gemini(image_path, prompt_file_path):&lt;br /&gt;
    # 1. API võtme laadimine keskkonnamuutujast&lt;br /&gt;
    api_key = os.environ.get(&amp;quot;GEMINI_API_KEY&amp;quot;)&lt;br /&gt;
    if not api_key:&lt;br /&gt;
        print(&amp;quot;Viga: GEMINI_API_KEY keskkonnamuutuja on puudu!&amp;quot;)&lt;br /&gt;
        return&lt;br /&gt;
&lt;br /&gt;
    # 2. Initsialiseerime uue teegi Kliendi&lt;br /&gt;
    client = genai.Client(api_key=api_key)&lt;br /&gt;
&lt;br /&gt;
    try:&lt;br /&gt;
        # 3. Loeme prompti tekstifailist sisse&lt;br /&gt;
        with open(prompt_file_path, &#039;r&#039;, encoding=&#039;utf-8&#039;) as file:&lt;br /&gt;
            prompt_text = file.read()&lt;br /&gt;
        &lt;br /&gt;
        # 4. Avame pildifaili&lt;br /&gt;
        img = Image.open(image_path)&lt;br /&gt;
        &lt;br /&gt;
        print(&amp;quot;Saadan päringu Gemini mudelile. Oota natuke...&amp;quot;)&lt;br /&gt;
        &lt;br /&gt;
        # 5. Argumendid &#039;model&#039; ja &#039;contents&#039; peavad olema nimeliselt välja kirjutatud&lt;br /&gt;
        response = client.models.generate_content(&lt;br /&gt;
            model=&#039;gemini-3-flash-preview&#039;,&lt;br /&gt;
            contents=[prompt_text, img]&lt;br /&gt;
        )&lt;br /&gt;
        &lt;br /&gt;
        # 6. Prindime vastuse välja&lt;br /&gt;
        print(&amp;quot;\n--- GEMINI VASTUS ---&amp;quot;)&lt;br /&gt;
        print(response.text)&lt;br /&gt;
        print(&amp;quot;---------------------\n&amp;quot;)&lt;br /&gt;
        &lt;br /&gt;
    except FileNotFoundError as e:&lt;br /&gt;
        print(f&amp;quot;Viga: Faili ei leitud. Kontrolli radu! Detailid: {e}&amp;quot;)&lt;br /&gt;
    except Exception as e:&lt;br /&gt;
        print(f&amp;quot;Päringu tegemisel tekkis ootamatu viga: {e}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Koodi käivitamine&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    PILDI_ASUKOHT = &amp;quot;room.jpg&amp;quot;        # Sinu toa pilt&lt;br /&gt;
    PROMPTI_ASUKOHT = &amp;quot;prompt.txt&amp;quot;    # Sinu juhised&lt;br /&gt;
    &lt;br /&gt;
    # Loome dummy faili testimiseks, kui prompt.txt faili veel pole&lt;br /&gt;
    if not os.path.exists(PROMPTI_ASUKOHT):&lt;br /&gt;
        with open(PROMPTI_ASUKOHT, &amp;quot;w&amp;quot;, encoding=&amp;quot;utf-8&amp;quot;) as f:&lt;br /&gt;
            f.write(&amp;quot;Palun väljasta ainult loogikafaktid selle toa kohta.&amp;quot;)&lt;br /&gt;
        print(f&amp;quot;Loodi näidis-prompt fail: {PROMPTI_ASUKOHT}&amp;quot;)&lt;br /&gt;
            &lt;br /&gt;
    analyze_image_with_gemini(PILDI_ASUKOHT, PROMPTI_ASUKOHT)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Optional: logictools vs command line reasoner gkc ===&lt;br /&gt;
&lt;br /&gt;
Logictools is unable to eat very large datasets and the options to control it are limited. Also, experimenting only on the web may be cumbersome. &lt;br /&gt;
&lt;br /&gt;
Thus I&#039;d recommend to download the full-powered version of the reasoner used in logictools  from https://github.com/tammet/gkc : it is best to use the somewhat older release https://github.com/tammet/gkc/releases/tag/v0.6.0 which has the same codebase as logictools. Just take the provided windows, linux or macos binary: no need to compile yourself.&lt;br /&gt;
&lt;br /&gt;
A rather thorough tutorial of gkc with examples is README.md here: https://github.com/tammet/gkc/blob/master/Examples/README.md&lt;br /&gt;
&lt;br /&gt;
== A tiny example ==&lt;br /&gt;
&lt;br /&gt;
This example is without an API and without image / expected output examples, just using the Gemini web interface:&lt;br /&gt;
&lt;br /&gt;
I attach this image to the question: https://turing.cs.ttu.ee/~tanel.tammet/room.jpg&lt;br /&gt;
and ask:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Your job is to create a structured, logic-based description of the objects in a room &lt;br /&gt;
and their relations on the attached image. &lt;br /&gt;
Here is an example description for some other room: &lt;br /&gt;
&lt;br /&gt;
nextTo(sofa, lamp).&lt;br /&gt;
nextTo(cabinet, desk).&lt;br /&gt;
nextTo(cabinet, plant1).&lt;br /&gt;
attachedTo(cabinet, hanger).&lt;br /&gt;
on(desk, plant2).&lt;br /&gt;
on(desk, glass).&lt;br /&gt;
on(desk, papers).&lt;br /&gt;
on(papers, phone).&lt;br /&gt;
in(glass, water).&lt;br /&gt;
nextTo(desk, window).&lt;br /&gt;
nextTo(desk, curtains).&lt;br /&gt;
nextTo(window, curtains).&lt;br /&gt;
name(plant1, &amp;quot;Ficus benjamina&amp;quot;).&lt;br /&gt;
name(plant2, &amp;quot;Spathiphyllum&amp;quot;).&lt;br /&gt;
weight(cabinet, 90).&lt;br /&gt;
&lt;br /&gt;
color(sofa, &#039;olive green&#039;).&lt;br /&gt;
color(curtains, blue).&lt;br /&gt;
color(plant1, green).&lt;br /&gt;
color(plant2, green).&lt;br /&gt;
&lt;br /&gt;
plant(plant1).&lt;br /&gt;
plant(plant2).&lt;br /&gt;
&lt;br /&gt;
nextTo(sofa, lamp).&lt;br /&gt;
nextTo(cabinet, desk).&lt;br /&gt;
nextTo(cabinet, plant1).&lt;br /&gt;
attachedTo(cabinet, hanger).&lt;br /&gt;
on(desk, plant2).&lt;br /&gt;
on(desk, glass).&lt;br /&gt;
on(desk, papers).&lt;br /&gt;
on(papers, phone).&lt;br /&gt;
in(glass, water).&lt;br /&gt;
nextTo(desk, window).&lt;br /&gt;
nextTo(desk, curtains).&lt;br /&gt;
nextTo(window, curtains).&lt;br /&gt;
name(plant1, &amp;quot;Ficus benjamina&amp;quot;).&lt;br /&gt;
name(plant2, &amp;quot;Spathiphyllum&amp;quot;).&lt;br /&gt;
weight(cabinet, 90).&lt;br /&gt;
&lt;br /&gt;
color(sofa, &#039;olive green&#039;).&lt;br /&gt;
color(curtains, blue).&lt;br /&gt;
color(plant1, green).&lt;br /&gt;
color(plant2, green).&lt;br /&gt;
&lt;br /&gt;
plant(plant1).&lt;br /&gt;
plant(plant2).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Gemini 3 Flash then answers me:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
This is a beautifully designed, Japandi-style living room. It balances warm wood textures with minimalist, neutral tones.&lt;br /&gt;
&lt;br /&gt;
Using the structured, logic-based format you requested, here is a description of the objects and their spatial relationships:&lt;br /&gt;
&lt;br /&gt;
### Object Relations&lt;br /&gt;
&lt;br /&gt;
* `on(floor, rug)`&lt;br /&gt;
* `on(rug, coffeeTable)`&lt;br /&gt;
* `on(rug, sofa)`&lt;br /&gt;
* `on(rug, chair1)`&lt;br /&gt;
* `on(rug, chair2)`&lt;br /&gt;
* `on(sofa, pillow)`&lt;br /&gt;
* `on(sofa, blanket)`&lt;br /&gt;
* `on(coffeeTable, glassVase)`&lt;br /&gt;
* `on(coffeeTable, decorativeBowl)`&lt;br /&gt;
* `in(glassVase, sprig)`&lt;br /&gt;
* `on(shelf, books)`&lt;br /&gt;
* `on(shelf, ceramicVases)`&lt;br /&gt;
* `nextTo(sofa, fireplace)`&lt;br /&gt;
* `nextTo(fireplace, ceramicVases)`&lt;br /&gt;
* `nextTo(chair2, tree)`&lt;br /&gt;
* `attachedTo(wall, painting)`&lt;br /&gt;
* `behind(tree, window)`&lt;br /&gt;
* `inside(fireplace, fire)`&lt;br /&gt;
&lt;br /&gt;
### Attributes and Metadata&lt;br /&gt;
&lt;br /&gt;
* `color(sofa, &#039;beige/oatmeal&#039;)`&lt;br /&gt;
* `color(chair1, &#039;cognac leather&#039;)`&lt;br /&gt;
* `color(chair2, &#039;cognac leather&#039;)`&lt;br /&gt;
* `color(coffeeTable, &#039;natural oak&#039;)`&lt;br /&gt;
* `color(wall, &#039;off-white&#039;)`&lt;br /&gt;
* `color(rug, &#039;light grey&#039;)`&lt;br /&gt;
* `material(wallPanels, wood)`&lt;br /&gt;
* `material(floor, wood)`&lt;br /&gt;
* `style(room, &#039;Japandi&#039;)`&lt;br /&gt;
* `name(tree, &amp;quot;Juniper Bonsai-style&amp;quot;)`&lt;br /&gt;
&lt;br /&gt;
Would you like me to generate a similar logic-based description for a different room, or perhaps suggest some furniture pieces that would complement this specific aesthetic?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, the system you have to build should take an image (or image url) as an argument, form a suitable API call and give back a directly usable logic-structure data, without any &amp;quot;This is a beautifully designed, ....&amp;quot; or &amp;quot;Would you like me ...&amp;quot; or *-starting bullets or backticks etc. You can achieve this is combination with suitable instructions in the prompt and simple programmatic cleaning of the resulting text.&lt;br /&gt;
&lt;br /&gt;
== API calling example ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of calling the gemini API directly with text (not images). NB! This code does not run &amp;quot;as is&amp;quot;: it assumes simple functions like llm_error(...), utils.debug_print(...), _gemini_supports_thinking(version) are available. It is recommended to use an LLM to generate your code. You can, for example, give LLM this code and ask to convert it to a directly runnable code where all the necessary utilities are replaced or implemented. Also, ask it to modify the code for sending images, either by upload or pointing to an url.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
def call_gemini(version, sentences, sysprompt, max_tokens):&lt;br /&gt;
  try:&lt;br /&gt;
    sf = open(gemini_secrets_file, &amp;quot;r&amp;quot;)&lt;br /&gt;
    key = sf.read().strip()&lt;br /&gt;
    sf.close()&lt;br /&gt;
  except:&lt;br /&gt;
    return llm_error(&amp;quot;Could not read Gemini API key file: &amp;quot; + str(gemini_secrets_file))&lt;br /&gt;
&lt;br /&gt;
  baseurl = &amp;quot;/v1beta/models/&amp;quot; + version + &amp;quot;:generateContent&amp;quot;&lt;br /&gt;
  genconfig = {&lt;br /&gt;
    &amp;quot;maxOutputTokens&amp;quot;: max_tokens,&lt;br /&gt;
    &amp;quot;temperature&amp;quot;: temperature&lt;br /&gt;
  }&lt;br /&gt;
  if _gemini_supports_thinking(version):&lt;br /&gt;
    genconfig[&amp;quot;thinkingConfig&amp;quot;] = {&amp;quot;thinkingLevel&amp;quot;: &amp;quot;medium&amp;quot;}&lt;br /&gt;
  call = {&lt;br /&gt;
    &amp;quot;contents&amp;quot;: [{&amp;quot;parts&amp;quot;: [{&amp;quot;text&amp;quot;: sentences}]}],&lt;br /&gt;
    &amp;quot;generationConfig&amp;quot;: genconfig&lt;br /&gt;
  }&lt;br /&gt;
  if sysprompt:&lt;br /&gt;
    call[&amp;quot;system_instruction&amp;quot;] = {&amp;quot;parts&amp;quot;: [{&amp;quot;text&amp;quot;: sysprompt}]}&lt;br /&gt;
&lt;br /&gt;
  utils.debug_print(&amp;quot;gemini call&amp;quot;, call, flag=calldebug)&lt;br /&gt;
  calltxt = json.dumps(call)&lt;br /&gt;
&lt;br /&gt;
  trycount = 0&lt;br /&gt;
  while True:&lt;br /&gt;
    host = &amp;quot;generativelanguage.googleapis.com&amp;quot;&lt;br /&gt;
    conn = http.client.HTTPSConnection(host, timeout=timeout)&lt;br /&gt;
    try:&lt;br /&gt;
      conn.request(&amp;quot;POST&amp;quot;, baseurl, calltxt,&lt;br /&gt;
                   headers={&amp;quot;content-Type&amp;quot;: &amp;quot;application/json&amp;quot;, &amp;quot;x-goog-api-key&amp;quot;: key})&lt;br /&gt;
      response = conn.getresponse()&lt;br /&gt;
    except KeyboardInterrupt:&lt;br /&gt;
      raise&lt;br /&gt;
    except:&lt;br /&gt;
      trycount += 1&lt;br /&gt;
      if conn: conn.close()&lt;br /&gt;
      if trycount &amp;gt; max_retries:&lt;br /&gt;
        return llm_error(&amp;quot;Gemini connection failed after &amp;quot; + str(max_retries) + &amp;quot; retries&amp;quot;)&lt;br /&gt;
      print(&amp;quot;Gemini connection failure, retrying...&amp;quot;)&lt;br /&gt;
      time.sleep(sleepseconds * trycount)&lt;br /&gt;
      continue&lt;br /&gt;
    if response.status != 200 or response.reason != &amp;quot;OK&amp;quot;:&lt;br /&gt;
      message = &amp;quot;&amp;quot;&lt;br /&gt;
      try:&lt;br /&gt;
        data = json.loads(response.read())&lt;br /&gt;
        if &amp;quot;error&amp;quot; in data and &amp;quot;message&amp;quot; in data[&amp;quot;error&amp;quot;]:&lt;br /&gt;
          message = &amp;quot;: &amp;quot; + data[&amp;quot;error&amp;quot;][&amp;quot;message&amp;quot;]&lt;br /&gt;
      except:&lt;br /&gt;
        pass&lt;br /&gt;
      trycount += 1&lt;br /&gt;
      if conn: conn.close()&lt;br /&gt;
      if trycount &amp;gt; max_retries:&lt;br /&gt;
        return llm_error(&amp;quot;Gemini API error &amp;quot; + str(response.status) + &amp;quot; &amp;quot; + str(response.reason) + message)&lt;br /&gt;
      print(&amp;quot;Gemini API failure, retrying:&amp;quot;, str(response.status), str(response.reason) + message)&lt;br /&gt;
      time.sleep(sleepseconds * trycount)&lt;br /&gt;
    else:&lt;br /&gt;
      break&lt;br /&gt;
&lt;br /&gt;
  rawdata = response.read()&lt;br /&gt;
  conn.close()&lt;br /&gt;
  try:&lt;br /&gt;
    data = json.loads(rawdata)&lt;br /&gt;
  except KeyboardInterrupt:&lt;br /&gt;
    raise&lt;br /&gt;
  except:&lt;br /&gt;
    return llm_error(&amp;quot;Gemini response is not valid JSON: &amp;quot; + str(rawdata))&lt;br /&gt;
&lt;br /&gt;
  if &amp;quot;candidates&amp;quot; not in data:&lt;br /&gt;
    return llm_error(&amp;quot;Gemini response has no candidates: &amp;quot; + str(rawdata))&lt;br /&gt;
  data = data[&amp;quot;candidates&amp;quot;][0]&lt;br /&gt;
  if &amp;quot;content&amp;quot; not in data:&lt;br /&gt;
    return llm_error(&amp;quot;Gemini response has no content: &amp;quot; + str(data))&lt;br /&gt;
  data = data[&amp;quot;content&amp;quot;]&lt;br /&gt;
  if &amp;quot;parts&amp;quot; not in data:&lt;br /&gt;
    return llm_error(&amp;quot;Gemini response has no parts: &amp;quot; + str(data))&lt;br /&gt;
&lt;br /&gt;
  utils.debug_print(&amp;quot;gemini response:&amp;quot;, data, flag=debug)&lt;br /&gt;
  res = &amp;quot;&amp;quot;&lt;br /&gt;
  for el in data[&amp;quot;parts&amp;quot;]:&lt;br /&gt;
    if &amp;quot;text&amp;quot; in el:&lt;br /&gt;
      res += el[&amp;quot;text&amp;quot;].strip()&lt;br /&gt;
  return res&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=KR_2026_homework_part_2&amp;diff=22786</id>
		<title>KR 2026 homework part 2</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=KR_2026_homework_part_2&amp;diff=22786"/>
		<updated>2026-03-17T09:13:12Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Initial ideas and suggestions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This lab is primarily an exploration in prompt engineering a VLM to create structured representations.&lt;br /&gt;
&lt;br /&gt;
== Task ==&lt;br /&gt;
&lt;br /&gt;
You will have to write a small system where a VLM ([https://en.wikipedia.org/wiki/Vision-language_model vision language model]: most large commercial LLMs are actually VLMs) describes the contents of an ordinary room, using the same schema and principles you used yourself for the the first lab. The main part of the work is prompt engineering for a VLM to do a sensibly good job.  &lt;br /&gt;
&lt;br /&gt;
Your system should be able to automatically generate a significant portion of the data you yourself wrote in the first lab by looking at an image, by looking at the same image. It should also be able to generate a noticeable amount of sensible structured data about an image for other, similar images of rooms. &lt;br /&gt;
&lt;br /&gt;
Crucially, your system should use the same principles / schema of knowledge representation you used yourself in the first lab. The logical reasoning you could do in the first lab should also be doable with the output of your system. The concrete choice of a representation language (json-ld or not) is up to you. No need to generate the knowledge in several representation languages.&lt;br /&gt;
&lt;br /&gt;
You have to present at least three images of a room (including the one used in the first lab) along with the output of system. For the image from the first lab, compare the data written by you to the data created by your system.&lt;br /&gt;
&lt;br /&gt;
== Initial ideas and suggestions ==&lt;br /&gt;
&lt;br /&gt;
The system could either:&lt;br /&gt;
* Ask the VLM to produce the structured information using your schema/encoding directly, or&lt;br /&gt;
* First ask the VLM to produce an intermediate representation and then convert the intermediate representation either programmatically or using an LLM to a suitable final representation. Here there are again several options:&lt;br /&gt;
** Let VLM produce an English representation and then use an LLM to convert it to a final representation.&lt;br /&gt;
** Let VLM produce some structured JSON not directly in the final format, and then programmatically (or with an LLM) convert to the final representation.&lt;br /&gt;
&lt;br /&gt;
Explore yourself which way works best for you. It is probably easier to start with the first, direct approach.&lt;br /&gt;
&lt;br /&gt;
=== Some tips about prompt engineering ===&lt;br /&gt;
&lt;br /&gt;
Create a prompt which is a balanced mixture of instructions and examples.&lt;br /&gt;
&lt;br /&gt;
The instructions should describe the task and the expected encoding. Give a nomenclature of predicates and explain how to represent what. Give several examples of room descriptions in the expected encoding. You can also give negative examples: output which is not OK.&lt;br /&gt;
&lt;br /&gt;
Importantly, give several examples of actual images along with the expected description in the expected encoding.&lt;br /&gt;
&lt;br /&gt;
NB! Do not use the same images / descriptions as in the prompt in your three demonstration image/description cases.&lt;br /&gt;
&lt;br /&gt;
=== Some tips about writing code ===&lt;br /&gt;
&lt;br /&gt;
First, it is highly recommended to use a VLM API for the task, not a web-based chat window (you cannot well write a system around a chat window). Look up the APIs. They may want you to use a credit card, although there are free ones available. The actual cost is going to be micoscopic, since you are not going to perform massive amounts of large API calls.&lt;br /&gt;
&lt;br /&gt;
Look up the API pages of large LLM providers. Most probably you can use the free tier of Gemini: https://ai.google.dev/gemini-api/docs/pricing&lt;br /&gt;
&lt;br /&gt;
When writing code, prefer doing it in a dialog with an LLM. Since the task is small, you can probably just use a chat window to describe the task, bring examples, get and debug the code. It is surely a bit better to use a proper coding tool like Claude code or VS Code plugin etc for the task, but it will be perfectly OK with just a chat window as well.&lt;br /&gt;
&lt;br /&gt;
=== Gemini API ===&lt;br /&gt;
&lt;br /&gt;
Gemini documentation examples about how to handle inline images: https://ai.google.dev/gemini-api/docs/image-understanding&lt;br /&gt;
&lt;br /&gt;
You can generate your API key in here: https://aistudio.google.com/&lt;br /&gt;
&lt;br /&gt;
Below is a simple starter code generated by Gemini shown in practice session. Recommendation is to &amp;lt;b&amp;gt;not&amp;lt;/b&amp;gt; use this code, but instead generate/write your own from scratch.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env python3&lt;br /&gt;
&lt;br /&gt;
import os&lt;br /&gt;
from google import genai&lt;br /&gt;
from PIL import Image&lt;br /&gt;
&lt;br /&gt;
def analyze_image_with_gemini(image_path, prompt_file_path):&lt;br /&gt;
    # 1. API võtme laadimine keskkonnamuutujast&lt;br /&gt;
    api_key = os.environ.get(&amp;quot;GEMINI_API_KEY&amp;quot;)&lt;br /&gt;
    if not api_key:&lt;br /&gt;
        print(&amp;quot;Viga: GEMINI_API_KEY keskkonnamuutuja on puudu!&amp;quot;)&lt;br /&gt;
        return&lt;br /&gt;
&lt;br /&gt;
    # 2. Initsialiseerime uue teegi Kliendi&lt;br /&gt;
    client = genai.Client(api_key=api_key)&lt;br /&gt;
&lt;br /&gt;
    try:&lt;br /&gt;
        # 3. Loeme prompti tekstifailist sisse&lt;br /&gt;
        with open(prompt_file_path, &#039;r&#039;, encoding=&#039;utf-8&#039;) as file:&lt;br /&gt;
            prompt_text = file.read()&lt;br /&gt;
        &lt;br /&gt;
        # 4. Avame pildifaili&lt;br /&gt;
        img = Image.open(image_path)&lt;br /&gt;
        &lt;br /&gt;
        print(&amp;quot;Saadan päringu Gemini mudelile. Oota natuke...&amp;quot;)&lt;br /&gt;
        &lt;br /&gt;
        # 5. Argumendid &#039;model&#039; ja &#039;contents&#039; peavad olema nimeliselt välja kirjutatud&lt;br /&gt;
        response = client.models.generate_content(&lt;br /&gt;
            model=&#039;gemini-3-flash-preview&#039;,&lt;br /&gt;
            contents=[prompt_text, img]&lt;br /&gt;
        )&lt;br /&gt;
        &lt;br /&gt;
        # 6. Prindime vastuse välja&lt;br /&gt;
        print(&amp;quot;\n--- GEMINI VASTUS ---&amp;quot;)&lt;br /&gt;
        print(response.text)&lt;br /&gt;
        print(&amp;quot;---------------------\n&amp;quot;)&lt;br /&gt;
        &lt;br /&gt;
    except FileNotFoundError as e:&lt;br /&gt;
        print(f&amp;quot;Viga: Faili ei leitud. Kontrolli radu! Detailid: {e}&amp;quot;)&lt;br /&gt;
    except Exception as e:&lt;br /&gt;
        print(f&amp;quot;Päringu tegemisel tekkis ootamatu viga: {e}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Koodi käivitamine&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    PILDI_ASUKOHT = &amp;quot;room.jpg&amp;quot;        # Sinu toa pilt&lt;br /&gt;
    PROMPTI_ASUKOHT = &amp;quot;prompt.txt&amp;quot;    # Sinu juhised&lt;br /&gt;
    &lt;br /&gt;
    # Loome dummy faili testimiseks, kui prompt.txt faili veel pole&lt;br /&gt;
    if not os.path.exists(PROMPTI_ASUKOHT):&lt;br /&gt;
        with open(PROMPTI_ASUKOHT, &amp;quot;w&amp;quot;, encoding=&amp;quot;utf-8&amp;quot;) as f:&lt;br /&gt;
            f.write(&amp;quot;Palun väljasta ainult loogikafaktid selle toa kohta.&amp;quot;)&lt;br /&gt;
        print(f&amp;quot;Loodi näidis-prompt fail: {PROMPTI_ASUKOHT}&amp;quot;)&lt;br /&gt;
            &lt;br /&gt;
    analyze_image_with_gemini(PILDI_ASUKOHT, PROMPTI_ASUKOHT)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== A tiny example ==&lt;br /&gt;
&lt;br /&gt;
This example is without an API and without image / expected output examples, just using the Gemini web interface:&lt;br /&gt;
&lt;br /&gt;
I attach this image to the question: https://turing.cs.ttu.ee/~tanel.tammet/room.jpg&lt;br /&gt;
and ask:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Your job is to create a structured, logic-based description of the objects in a room &lt;br /&gt;
and their relations on the attached image. &lt;br /&gt;
Here is an example description for some other room: &lt;br /&gt;
&lt;br /&gt;
nextTo(sofa, lamp).&lt;br /&gt;
nextTo(cabinet, desk).&lt;br /&gt;
nextTo(cabinet, plant1).&lt;br /&gt;
attachedTo(cabinet, hanger).&lt;br /&gt;
on(desk, plant2).&lt;br /&gt;
on(desk, glass).&lt;br /&gt;
on(desk, papers).&lt;br /&gt;
on(papers, phone).&lt;br /&gt;
in(glass, water).&lt;br /&gt;
nextTo(desk, window).&lt;br /&gt;
nextTo(desk, curtains).&lt;br /&gt;
nextTo(window, curtains).&lt;br /&gt;
name(plant1, &amp;quot;Ficus benjamina&amp;quot;).&lt;br /&gt;
name(plant2, &amp;quot;Spathiphyllum&amp;quot;).&lt;br /&gt;
weight(cabinet, 90).&lt;br /&gt;
&lt;br /&gt;
color(sofa, &#039;olive green&#039;).&lt;br /&gt;
color(curtains, blue).&lt;br /&gt;
color(plant1, green).&lt;br /&gt;
color(plant2, green).&lt;br /&gt;
&lt;br /&gt;
plant(plant1).&lt;br /&gt;
plant(plant2).&lt;br /&gt;
&lt;br /&gt;
nextTo(sofa, lamp).&lt;br /&gt;
nextTo(cabinet, desk).&lt;br /&gt;
nextTo(cabinet, plant1).&lt;br /&gt;
attachedTo(cabinet, hanger).&lt;br /&gt;
on(desk, plant2).&lt;br /&gt;
on(desk, glass).&lt;br /&gt;
on(desk, papers).&lt;br /&gt;
on(papers, phone).&lt;br /&gt;
in(glass, water).&lt;br /&gt;
nextTo(desk, window).&lt;br /&gt;
nextTo(desk, curtains).&lt;br /&gt;
nextTo(window, curtains).&lt;br /&gt;
name(plant1, &amp;quot;Ficus benjamina&amp;quot;).&lt;br /&gt;
name(plant2, &amp;quot;Spathiphyllum&amp;quot;).&lt;br /&gt;
weight(cabinet, 90).&lt;br /&gt;
&lt;br /&gt;
color(sofa, &#039;olive green&#039;).&lt;br /&gt;
color(curtains, blue).&lt;br /&gt;
color(plant1, green).&lt;br /&gt;
color(plant2, green).&lt;br /&gt;
&lt;br /&gt;
plant(plant1).&lt;br /&gt;
plant(plant2).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Gemini 3 Flash then answers me:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
This is a beautifully designed, Japandi-style living room. It balances warm wood textures with minimalist, neutral tones.&lt;br /&gt;
&lt;br /&gt;
Using the structured, logic-based format you requested, here is a description of the objects and their spatial relationships:&lt;br /&gt;
&lt;br /&gt;
### Object Relations&lt;br /&gt;
&lt;br /&gt;
* `on(floor, rug)`&lt;br /&gt;
* `on(rug, coffeeTable)`&lt;br /&gt;
* `on(rug, sofa)`&lt;br /&gt;
* `on(rug, chair1)`&lt;br /&gt;
* `on(rug, chair2)`&lt;br /&gt;
* `on(sofa, pillow)`&lt;br /&gt;
* `on(sofa, blanket)`&lt;br /&gt;
* `on(coffeeTable, glassVase)`&lt;br /&gt;
* `on(coffeeTable, decorativeBowl)`&lt;br /&gt;
* `in(glassVase, sprig)`&lt;br /&gt;
* `on(shelf, books)`&lt;br /&gt;
* `on(shelf, ceramicVases)`&lt;br /&gt;
* `nextTo(sofa, fireplace)`&lt;br /&gt;
* `nextTo(fireplace, ceramicVases)`&lt;br /&gt;
* `nextTo(chair2, tree)`&lt;br /&gt;
* `attachedTo(wall, painting)`&lt;br /&gt;
* `behind(tree, window)`&lt;br /&gt;
* `inside(fireplace, fire)`&lt;br /&gt;
&lt;br /&gt;
### Attributes and Metadata&lt;br /&gt;
&lt;br /&gt;
* `color(sofa, &#039;beige/oatmeal&#039;)`&lt;br /&gt;
* `color(chair1, &#039;cognac leather&#039;)`&lt;br /&gt;
* `color(chair2, &#039;cognac leather&#039;)`&lt;br /&gt;
* `color(coffeeTable, &#039;natural oak&#039;)`&lt;br /&gt;
* `color(wall, &#039;off-white&#039;)`&lt;br /&gt;
* `color(rug, &#039;light grey&#039;)`&lt;br /&gt;
* `material(wallPanels, wood)`&lt;br /&gt;
* `material(floor, wood)`&lt;br /&gt;
* `style(room, &#039;Japandi&#039;)`&lt;br /&gt;
* `name(tree, &amp;quot;Juniper Bonsai-style&amp;quot;)`&lt;br /&gt;
&lt;br /&gt;
Would you like me to generate a similar logic-based description for a different room, or perhaps suggest some furniture pieces that would complement this specific aesthetic?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, the system you have to build should take an image (or image url) as an argument, form a suitable API call and give back a directly usable logic-structure data, without any &amp;quot;This is a beautifully designed, ....&amp;quot; or &amp;quot;Would you like me ...&amp;quot; or *-starting bullets or backticks etc. You can achieve this is combination with suitable instructions in the prompt and simple programmatic cleaning of the resulting text.&lt;br /&gt;
&lt;br /&gt;
== API calling example ==&lt;br /&gt;
&lt;br /&gt;
Here is an example of calling the gemini API directly with text (not images). NB! This code does not run &amp;quot;as is&amp;quot;: it assumes simple functions like llm_error(...), utils.debug_print(...), _gemini_supports_thinking(version) are available. It is recommended to use an LLM to generate your code. You can, for example, give LLM this code and ask to convert it to a directly runnable code where all the necessary utilities are replaced or implemented. Also, ask it to modify the code for sending images, either by upload or pointing to an url.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
def call_gemini(version, sentences, sysprompt, max_tokens):&lt;br /&gt;
  try:&lt;br /&gt;
    sf = open(gemini_secrets_file, &amp;quot;r&amp;quot;)&lt;br /&gt;
    key = sf.read().strip()&lt;br /&gt;
    sf.close()&lt;br /&gt;
  except:&lt;br /&gt;
    return llm_error(&amp;quot;Could not read Gemini API key file: &amp;quot; + str(gemini_secrets_file))&lt;br /&gt;
&lt;br /&gt;
  baseurl = &amp;quot;/v1beta/models/&amp;quot; + version + &amp;quot;:generateContent&amp;quot;&lt;br /&gt;
  genconfig = {&lt;br /&gt;
    &amp;quot;maxOutputTokens&amp;quot;: max_tokens,&lt;br /&gt;
    &amp;quot;temperature&amp;quot;: temperature&lt;br /&gt;
  }&lt;br /&gt;
  if _gemini_supports_thinking(version):&lt;br /&gt;
    genconfig[&amp;quot;thinkingConfig&amp;quot;] = {&amp;quot;thinkingLevel&amp;quot;: &amp;quot;medium&amp;quot;}&lt;br /&gt;
  call = {&lt;br /&gt;
    &amp;quot;contents&amp;quot;: [{&amp;quot;parts&amp;quot;: [{&amp;quot;text&amp;quot;: sentences}]}],&lt;br /&gt;
    &amp;quot;generationConfig&amp;quot;: genconfig&lt;br /&gt;
  }&lt;br /&gt;
  if sysprompt:&lt;br /&gt;
    call[&amp;quot;system_instruction&amp;quot;] = {&amp;quot;parts&amp;quot;: [{&amp;quot;text&amp;quot;: sysprompt}]}&lt;br /&gt;
&lt;br /&gt;
  utils.debug_print(&amp;quot;gemini call&amp;quot;, call, flag=calldebug)&lt;br /&gt;
  calltxt = json.dumps(call)&lt;br /&gt;
&lt;br /&gt;
  trycount = 0&lt;br /&gt;
  while True:&lt;br /&gt;
    host = &amp;quot;generativelanguage.googleapis.com&amp;quot;&lt;br /&gt;
    conn = http.client.HTTPSConnection(host, timeout=timeout)&lt;br /&gt;
    try:&lt;br /&gt;
      conn.request(&amp;quot;POST&amp;quot;, baseurl, calltxt,&lt;br /&gt;
                   headers={&amp;quot;content-Type&amp;quot;: &amp;quot;application/json&amp;quot;, &amp;quot;x-goog-api-key&amp;quot;: key})&lt;br /&gt;
      response = conn.getresponse()&lt;br /&gt;
    except KeyboardInterrupt:&lt;br /&gt;
      raise&lt;br /&gt;
    except:&lt;br /&gt;
      trycount += 1&lt;br /&gt;
      if conn: conn.close()&lt;br /&gt;
      if trycount &amp;gt; max_retries:&lt;br /&gt;
        return llm_error(&amp;quot;Gemini connection failed after &amp;quot; + str(max_retries) + &amp;quot; retries&amp;quot;)&lt;br /&gt;
      print(&amp;quot;Gemini connection failure, retrying...&amp;quot;)&lt;br /&gt;
      time.sleep(sleepseconds * trycount)&lt;br /&gt;
      continue&lt;br /&gt;
    if response.status != 200 or response.reason != &amp;quot;OK&amp;quot;:&lt;br /&gt;
      message = &amp;quot;&amp;quot;&lt;br /&gt;
      try:&lt;br /&gt;
        data = json.loads(response.read())&lt;br /&gt;
        if &amp;quot;error&amp;quot; in data and &amp;quot;message&amp;quot; in data[&amp;quot;error&amp;quot;]:&lt;br /&gt;
          message = &amp;quot;: &amp;quot; + data[&amp;quot;error&amp;quot;][&amp;quot;message&amp;quot;]&lt;br /&gt;
      except:&lt;br /&gt;
        pass&lt;br /&gt;
      trycount += 1&lt;br /&gt;
      if conn: conn.close()&lt;br /&gt;
      if trycount &amp;gt; max_retries:&lt;br /&gt;
        return llm_error(&amp;quot;Gemini API error &amp;quot; + str(response.status) + &amp;quot; &amp;quot; + str(response.reason) + message)&lt;br /&gt;
      print(&amp;quot;Gemini API failure, retrying:&amp;quot;, str(response.status), str(response.reason) + message)&lt;br /&gt;
      time.sleep(sleepseconds * trycount)&lt;br /&gt;
    else:&lt;br /&gt;
      break&lt;br /&gt;
&lt;br /&gt;
  rawdata = response.read()&lt;br /&gt;
  conn.close()&lt;br /&gt;
  try:&lt;br /&gt;
    data = json.loads(rawdata)&lt;br /&gt;
  except KeyboardInterrupt:&lt;br /&gt;
    raise&lt;br /&gt;
  except:&lt;br /&gt;
    return llm_error(&amp;quot;Gemini response is not valid JSON: &amp;quot; + str(rawdata))&lt;br /&gt;
&lt;br /&gt;
  if &amp;quot;candidates&amp;quot; not in data:&lt;br /&gt;
    return llm_error(&amp;quot;Gemini response has no candidates: &amp;quot; + str(rawdata))&lt;br /&gt;
  data = data[&amp;quot;candidates&amp;quot;][0]&lt;br /&gt;
  if &amp;quot;content&amp;quot; not in data:&lt;br /&gt;
    return llm_error(&amp;quot;Gemini response has no content: &amp;quot; + str(data))&lt;br /&gt;
  data = data[&amp;quot;content&amp;quot;]&lt;br /&gt;
  if &amp;quot;parts&amp;quot; not in data:&lt;br /&gt;
    return llm_error(&amp;quot;Gemini response has no parts: &amp;quot; + str(data))&lt;br /&gt;
&lt;br /&gt;
  utils.debug_print(&amp;quot;gemini response:&amp;quot;, data, flag=debug)&lt;br /&gt;
  res = &amp;quot;&amp;quot;&lt;br /&gt;
  for el in data[&amp;quot;parts&amp;quot;]:&lt;br /&gt;
    if &amp;quot;text&amp;quot; in el:&lt;br /&gt;
      res += el[&amp;quot;text&amp;quot;].strip()&lt;br /&gt;
  return res&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22773</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22773"/>
		<updated>2026-03-13T18:04:48Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Third lab: questions in NLP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2025|2025]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! 23 ja 24 veebruar on puhkepäevad&amp;lt;/font&amp;gt; =&lt;br /&gt;
Esmaspäev, 23. veebruar (ja ka teisipäev, 24. veebruar) on ülikoolis puhkepäevad ja õppetööd ei toimu.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! Materjalid hetkel uuendamisel&amp;lt;/font&amp;gt; =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Mondays 12:00-13:30 room SOC 414&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Tuesdays 08:00-09:30 room &amp;lt;s&amp;gt;MEK-122&amp;lt;/s&amp;gt; MEK-109.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3A-xXLRsURTirXcCCkQN46w4wYRJaarxbl797KeThtWXY1%40thread.tacv2/conversations?groupId=30b97413-f1b1-404d-8498-b35024d1a002&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams group] of the course. The code for joining is zb3z457.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/33688408323196?p=sd6YBPK9VZ7gRe7Zro teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/3558703223396?p=zc4Lgecwoy1e9Yhav9 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam (10 of these on the page), while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials (20 on the page) will also come up, but less and/or in a simpler form. &lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
== The first weekly task ==&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 17. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjalile [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
client table: id name balance&lt;br /&gt;
1 john 100 &lt;br /&gt;
2 pete -200&lt;br /&gt;
&lt;br /&gt;
cars table: id model owner&lt;br /&gt;
1 ford 1&lt;br /&gt;
2 opel 2&lt;br /&gt;
3 saab 2&lt;br /&gt;
&lt;br /&gt;
select client.name, client.balance&lt;br /&gt;
from client where balance&amp;lt;0&lt;br /&gt;
&lt;br /&gt;
select client.name, cars.model from client, cars&lt;br /&gt;
where client.id=cars.owner&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
* Kasuta kindlasti oma taltech.ee aadressi, sest muidu võib kiri lõpetada rämpspostis!&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The second weekly task ==&lt;br /&gt;
&lt;br /&gt;
Selle ülesande mõte on veidi praktiseerida JSON-LD esitusega. Sinu konkreetne ülesanne on võtta oma esimene nädalaülesanne ja esitada needsamad andmed (ja soovitavalt ka reeglid) JSON-LD kujul.&lt;br /&gt;
&lt;br /&gt;
Vaata alustuseks json-ld näiteid [https://logictools.org/json.html logictoolsi json-tabi alt]. NB! Enamus näiteid &amp;quot;example&amp;quot; valikuboksist ei ole konventsionaalne json-ld, aga mitmed on.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
* Kasuta saatmiseks kindlasti taltech.ee aadressi, sest muidu võib kiri minna rämpspostiks!&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; The plan for practice work is currently being updated. The information below is not up to date yet, except for the first lab, which is already updated for 2026.&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2026 homework part 1|2026 task for the first lab]] is about encoding nontrivial information in various ways (standard logic, rdf, json-ld) and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Deadline: 10. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2026 homework part 2|2026 task for the second lab]] is about using a VLM (visual language model) to get a structured description from an image which would fit with the pre-existing simple world model.&lt;br /&gt;
&lt;br /&gt;
Deadline: 7. April&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
&amp;lt;!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Deadline: 5. May&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- We will do live experimenting for the third lab at the April 22 lecture and will then add more interesting parts to the notes above. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NB! The task description above has just been updated (at 23. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin. &amp;lt;!-- [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) --&amp;gt; [https://web.stanford.edu/~jurafsky/slp3/ the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read [https://web.stanford.edu/~jurafsky/slp3/20.pdf chapter 6 about extracting information] and the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/H.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture] --&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2025 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 2. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2026.pdf|teadmised_intro2026.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel] &amp;lt;!--, [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel] --&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 9. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl + reasoner: 16. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
What the reasoner does:&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: DPP ontology development. 2. March ===&lt;br /&gt;
&lt;br /&gt;
Loengu annab Riina. Digital Product Passport (DPP)&lt;br /&gt;
kui näide praktilisest ontoloogia/sõnastiku arendamisest [https://cirpassproject.eu/dpp-in-a-nutshell/ CIRPASS] projektis.&lt;br /&gt;
&lt;br /&gt;
[https://dpp.vocabulary-hub.eu/ Hetkeseisu algusleht]. &lt;br /&gt;
&lt;br /&gt;
[https://cirpass2.eu/ CIRPASS-2]&lt;br /&gt;
&lt;br /&gt;
[https://si-digital-framework.org/SI/units?lang=en Ühikute ontoloogia]&lt;br /&gt;
&lt;br /&gt;
[https://www.w3.org/TR/shacl/ SHACL]&lt;br /&gt;
&lt;br /&gt;
[https://untp.unece.org/docs/specification/DigitalProductPassport/ UNTP DPP]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: märtsi algul ===&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Next homework and looking into main large knowledge bases: 9. March  ===&lt;br /&gt;
&lt;br /&gt;
We will first present the next homework.&lt;br /&gt;
&lt;br /&gt;
Then we will continue with existing large knowledge bases.&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors: 16 March ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors]. &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM) ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_intro.pdf|Lecture material]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning + open/closed world, planning, frame problem, blocks world. 1 April ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;First, some results/challenges in neurosymbolic reasoning.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]&lt;br /&gt;
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]&lt;br /&gt;
* [https://arcprize.org/ arcprize]. See also [https://liusida.github.io/ARC/ ARC v1 for humans], [https://www.youtube.com/watch?v=jSAT_RuJ_Cg MLST about the state of v1 solvers], [https://www.youtube.com/watch?v=M3b59lZYBW8 MLST video introducing ARC v2]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Second, planning, open/closed worlds and the frame problem. &amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Reasoning with uncertainty and intro to lab 3 ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links. In particular, [https://en.wikipedia.org/wiki/Bayesian_inference Wiki on Bayesian inference] and [https://math.mit.edu/~dav/05.dir/class11-prep.pdf this]&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: visual reasoning  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher Mohit Vaishnav. You may want to have a look at his [https://vaishnavmohit.github.io/phd_thesis/ thesis] from 2023.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: third lab live experiments ===&lt;br /&gt;
&lt;br /&gt;
We will do live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
Previous plan was: continue with uncertainty, numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing  ===&lt;br /&gt;
&lt;br /&gt;
The focus of the lecture is on [https://en.wikipedia.org/wiki/Semantic_parsing semantic parsing].&lt;br /&gt;
&lt;br /&gt;
Here are Martin&#039;s slides from 2024 [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
We will look at both (a) classic paradigms of semantic parsing (as on the slides), (b) using LLMs and alternative modern paradigms for semantic parsing.&lt;br /&gt;
&lt;br /&gt;
About important concepts in parsing:&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Part_of_speech Part-Of-Speech (POS)] and [https://en.wikipedia.org/wiki/Part-of-speech_tagging POS tagging]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/18.pdf Jurafsky&amp;amp;Martin: Constituency Parsing]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/19.pdf Jurafsky&amp;amp;Martin: Dependency Parsing]&lt;br /&gt;
&lt;br /&gt;
Some important toolkits and representation schemes:&lt;br /&gt;
* [https://spacy.io spacy], [[a small spacy UD parsing example]]&lt;br /&gt;
* [https://stanfordnlp.github.io/stanza/ stanza]&lt;br /&gt;
* [https://universaldependencies.org/ universal dependencies]&lt;br /&gt;
&lt;br /&gt;
Some draft parsing papers:&lt;br /&gt;
* [[Media:concepts_draft_paper.pdf|concepts, based on UD]]&lt;br /&gt;
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]&lt;br /&gt;
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]&lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued  ===&lt;br /&gt;
&lt;br /&gt;
Lecture will be given by Martin Verrev on teams only (not the lecture room).&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning and consultation for the exam  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22772</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22772"/>
		<updated>2026-03-13T18:04:15Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Second lab */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2025|2025]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! 23 ja 24 veebruar on puhkepäevad&amp;lt;/font&amp;gt; =&lt;br /&gt;
Esmaspäev, 23. veebruar (ja ka teisipäev, 24. veebruar) on ülikoolis puhkepäevad ja õppetööd ei toimu.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! Materjalid hetkel uuendamisel&amp;lt;/font&amp;gt; =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Mondays 12:00-13:30 room SOC 414&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Tuesdays 08:00-09:30 room &amp;lt;s&amp;gt;MEK-122&amp;lt;/s&amp;gt; MEK-109.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3A-xXLRsURTirXcCCkQN46w4wYRJaarxbl797KeThtWXY1%40thread.tacv2/conversations?groupId=30b97413-f1b1-404d-8498-b35024d1a002&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams group] of the course. The code for joining is zb3z457.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/33688408323196?p=sd6YBPK9VZ7gRe7Zro teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/3558703223396?p=zc4Lgecwoy1e9Yhav9 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam (10 of these on the page), while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials (20 on the page) will also come up, but less and/or in a simpler form. &lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
== The first weekly task ==&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 17. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjalile [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
client table: id name balance&lt;br /&gt;
1 john 100 &lt;br /&gt;
2 pete -200&lt;br /&gt;
&lt;br /&gt;
cars table: id model owner&lt;br /&gt;
1 ford 1&lt;br /&gt;
2 opel 2&lt;br /&gt;
3 saab 2&lt;br /&gt;
&lt;br /&gt;
select client.name, client.balance&lt;br /&gt;
from client where balance&amp;lt;0&lt;br /&gt;
&lt;br /&gt;
select client.name, cars.model from client, cars&lt;br /&gt;
where client.id=cars.owner&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
* Kasuta kindlasti oma taltech.ee aadressi, sest muidu võib kiri lõpetada rämpspostis!&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The second weekly task ==&lt;br /&gt;
&lt;br /&gt;
Selle ülesande mõte on veidi praktiseerida JSON-LD esitusega. Sinu konkreetne ülesanne on võtta oma esimene nädalaülesanne ja esitada needsamad andmed (ja soovitavalt ka reeglid) JSON-LD kujul.&lt;br /&gt;
&lt;br /&gt;
Vaata alustuseks json-ld näiteid [https://logictools.org/json.html logictoolsi json-tabi alt]. NB! Enamus näiteid &amp;quot;example&amp;quot; valikuboksist ei ole konventsionaalne json-ld, aga mitmed on.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
* Kasuta saatmiseks kindlasti taltech.ee aadressi, sest muidu võib kiri minna rämpspostiks!&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; The plan for practice work is currently being updated. The information below is not up to date yet, except for the first lab, which is already updated for 2026.&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2026 homework part 1|2026 task for the first lab]] is about encoding nontrivial information in various ways (standard logic, rdf, json-ld) and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Deadline: 10. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2026 homework part 2|2026 task for the second lab]] is about using a VLM (visual language model) to get a structured description from an image which would fit with the pre-existing simple world model.&lt;br /&gt;
&lt;br /&gt;
Deadline: 7. April&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
&amp;lt;!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Deadline: 12. May&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- We will do live experimenting for the third lab at the April 22 lecture and will then add more interesting parts to the notes above. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NB! The task description above has just been updated (at 23. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin. &amp;lt;!-- [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) --&amp;gt; [https://web.stanford.edu/~jurafsky/slp3/ the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read [https://web.stanford.edu/~jurafsky/slp3/20.pdf chapter 6 about extracting information] and the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/H.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture] --&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2025 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 2. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2026.pdf|teadmised_intro2026.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel] &amp;lt;!--, [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel] --&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 9. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl + reasoner: 16. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
What the reasoner does:&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: DPP ontology development. 2. March ===&lt;br /&gt;
&lt;br /&gt;
Loengu annab Riina. Digital Product Passport (DPP)&lt;br /&gt;
kui näide praktilisest ontoloogia/sõnastiku arendamisest [https://cirpassproject.eu/dpp-in-a-nutshell/ CIRPASS] projektis.&lt;br /&gt;
&lt;br /&gt;
[https://dpp.vocabulary-hub.eu/ Hetkeseisu algusleht]. &lt;br /&gt;
&lt;br /&gt;
[https://cirpass2.eu/ CIRPASS-2]&lt;br /&gt;
&lt;br /&gt;
[https://si-digital-framework.org/SI/units?lang=en Ühikute ontoloogia]&lt;br /&gt;
&lt;br /&gt;
[https://www.w3.org/TR/shacl/ SHACL]&lt;br /&gt;
&lt;br /&gt;
[https://untp.unece.org/docs/specification/DigitalProductPassport/ UNTP DPP]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: märtsi algul ===&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Next homework and looking into main large knowledge bases: 9. March  ===&lt;br /&gt;
&lt;br /&gt;
We will first present the next homework.&lt;br /&gt;
&lt;br /&gt;
Then we will continue with existing large knowledge bases.&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors: 16 March ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors]. &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM) ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_intro.pdf|Lecture material]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning + open/closed world, planning, frame problem, blocks world. 1 April ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;First, some results/challenges in neurosymbolic reasoning.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]&lt;br /&gt;
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]&lt;br /&gt;
* [https://arcprize.org/ arcprize]. See also [https://liusida.github.io/ARC/ ARC v1 for humans], [https://www.youtube.com/watch?v=jSAT_RuJ_Cg MLST about the state of v1 solvers], [https://www.youtube.com/watch?v=M3b59lZYBW8 MLST video introducing ARC v2]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Second, planning, open/closed worlds and the frame problem. &amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Reasoning with uncertainty and intro to lab 3 ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links. In particular, [https://en.wikipedia.org/wiki/Bayesian_inference Wiki on Bayesian inference] and [https://math.mit.edu/~dav/05.dir/class11-prep.pdf this]&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: visual reasoning  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher Mohit Vaishnav. You may want to have a look at his [https://vaishnavmohit.github.io/phd_thesis/ thesis] from 2023.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: third lab live experiments ===&lt;br /&gt;
&lt;br /&gt;
We will do live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
Previous plan was: continue with uncertainty, numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing  ===&lt;br /&gt;
&lt;br /&gt;
The focus of the lecture is on [https://en.wikipedia.org/wiki/Semantic_parsing semantic parsing].&lt;br /&gt;
&lt;br /&gt;
Here are Martin&#039;s slides from 2024 [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
We will look at both (a) classic paradigms of semantic parsing (as on the slides), (b) using LLMs and alternative modern paradigms for semantic parsing.&lt;br /&gt;
&lt;br /&gt;
About important concepts in parsing:&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Part_of_speech Part-Of-Speech (POS)] and [https://en.wikipedia.org/wiki/Part-of-speech_tagging POS tagging]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/18.pdf Jurafsky&amp;amp;Martin: Constituency Parsing]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/19.pdf Jurafsky&amp;amp;Martin: Dependency Parsing]&lt;br /&gt;
&lt;br /&gt;
Some important toolkits and representation schemes:&lt;br /&gt;
* [https://spacy.io spacy], [[a small spacy UD parsing example]]&lt;br /&gt;
* [https://stanfordnlp.github.io/stanza/ stanza]&lt;br /&gt;
* [https://universaldependencies.org/ universal dependencies]&lt;br /&gt;
&lt;br /&gt;
Some draft parsing papers:&lt;br /&gt;
* [[Media:concepts_draft_paper.pdf|concepts, based on UD]]&lt;br /&gt;
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]&lt;br /&gt;
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]&lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued  ===&lt;br /&gt;
&lt;br /&gt;
Lecture will be given by Martin Verrev on teams only (not the lecture room).&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning and consultation for the exam  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=KR_2026_homework_part_1&amp;diff=22752</id>
		<title>KR 2026 homework part 1</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=KR_2026_homework_part_1&amp;diff=22752"/>
		<updated>2026-03-03T11:04:38Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Task */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a first draft description of the task. Additional helpful details and examples will be added during February.&lt;br /&gt;
&lt;br /&gt;
== Task ==&lt;br /&gt;
&lt;br /&gt;
You will have to describe the contents of an ordinary room for an intelligent robot who is going to navigate the room and is able to understand what is there, answer questions about the room, etc.&lt;br /&gt;
&lt;br /&gt;
The room has to be described in a formal way. Enhanced with some rules, you should be able to formally find and derive information about the room, like what is higher, what is lower, what is above/below, find objects with some properties, etc. For example: what is above the table? is there a blue chair in the room? is there something weighing more than 100 kg in the room? what is near the blue book?&lt;br /&gt;
&lt;br /&gt;
How to proceed:&lt;br /&gt;
&lt;br /&gt;
* First, take a photo (or better, a few photos) of an ordinary room with a reasonable number of various objects. The photo will be made public. Do not use a room somebody else is using for the same task! You will have to formalize information about the contents of the room, using this photo. &lt;br /&gt;
&lt;br /&gt;
* Second, formalize the contents using a conventional logic format understandable by https://logictools.org/ . You cannot realistically formalize everything in a room: do it to a reasonable, yet interesting level / number of objects described.&lt;br /&gt;
&lt;br /&gt;
* Third, convert the contents to [https://json-ld.org/ json-ld]: the point here is to get some experience with json-ld, not that you really need it for the following steps here (although you can use it with the https://github.com/tammet/json-ld-logic extension).&lt;br /&gt;
&lt;br /&gt;
* Fourth, invent and add sensible common-sense rules about the physical objects in the room. Try to make some rules a little more complex, e.g., make one rule use another rule, use arithmetic predicates etc.&lt;br /&gt;
&lt;br /&gt;
* Fifth, demonstrate how https://logictools.org/ is able to answer (or not) various questions (at least 5) about the room. Both successes and failures are interesting. &lt;br /&gt;
&lt;br /&gt;
Observe that logictools is able to understand a specific json format, which includes a subset of json-ld. See https://logictools.org/json.html , the &amp;quot;examples&amp;quot; selection box and the spec https://github.com/tammet/json-ld-logic for that. Under &amp;quot;Advanced&amp;quot; button you can convert between two representations. NB! This conversion does not convert conventional logic to json-ld. Also, using json-ld directly as a first format for representation might be cumbersone, and logictool has different quirks and limitations handling json-ld directly. In other words, while it makes sense to experiment with logictools with json-ld, use this combo for experimentation, and maybe not as a primary representation format, unless you are brave :)&lt;br /&gt;
&lt;br /&gt;
== Presentation ==&lt;br /&gt;
&lt;br /&gt;
The results of the lab should be shown to Riina during lab time, so she can ask questions and discuss the results and the process.&lt;br /&gt;
&lt;br /&gt;
== LLM policy ==&lt;br /&gt;
&lt;br /&gt;
It is OK to use an LLM, but do &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;not yet show&amp;lt;/font&amp;gt; your room image to an LLM: we will experiment with LLM image handling in later practice tasks.&lt;br /&gt;
&lt;br /&gt;
Also, please add a short information about your llm use to the overview of the results: which LLMs you used, for what and what was the experience.&lt;br /&gt;
&lt;br /&gt;
== Ideas and inspiration ==&lt;br /&gt;
&lt;br /&gt;
For inspiration you may want to have a look at the following relatively complex suggestions of encoding information about rooms and things. Please do not try to use these exactly, just read them for ideas:&lt;br /&gt;
&lt;br /&gt;
* https://docs.brickschema.org/modeling/collections.html&lt;br /&gt;
* https://w3c-lbd-cg.github.io/bot/&lt;br /&gt;
* https://www.w3.org/WoT/&lt;br /&gt;
* https://www.w3.org/TR/2025/WD-wot-thing-description-2.0-20251104/#td-basic-types-mapping&lt;br /&gt;
* http://www.funstep.org/ontology/ | http://www.funstep.org/download/ | Visualiseerimiseks näiteks: https://protege.stanford.edu/&lt;br /&gt;
&lt;br /&gt;
Space and time, fairly complex ideas:&lt;br /&gt;
&lt;br /&gt;
* https://www.irit.fr/publis/LILAC/V-SRR97.pdf&lt;br /&gt;
&lt;br /&gt;
== 10. veebruari harjutus ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nextTo(sofa, lamp).&lt;br /&gt;
nextTo(cabinet, desk).&lt;br /&gt;
nextTo(cabinet, plant1).&lt;br /&gt;
attachedTo(cabinet, hanger).&lt;br /&gt;
on(desk, plant2).&lt;br /&gt;
on(desk, glass).&lt;br /&gt;
on(desk, papers).&lt;br /&gt;
on(papers, phone).&lt;br /&gt;
in(glass, water).&lt;br /&gt;
nextTo(desk, window).&lt;br /&gt;
nextTo(desk, curtains).&lt;br /&gt;
nextTo(window, curtains).&lt;br /&gt;
name(plant1, &amp;quot;Ficus benjamina&amp;quot;).&lt;br /&gt;
name(plant2, &amp;quot;Spathiphyllum&amp;quot;).&lt;br /&gt;
weight(cabinet, 90).&lt;br /&gt;
&lt;br /&gt;
color(sofa, &#039;olive green&#039;).&lt;br /&gt;
color(curtains, blue).&lt;br /&gt;
color(plant1, green).&lt;br /&gt;
color(plant2, green).&lt;br /&gt;
&lt;br /&gt;
plant(plant1).&lt;br /&gt;
plant(plant2).&lt;br /&gt;
&lt;br /&gt;
%rules&lt;br /&gt;
on(X,Y) &amp;amp; in(Y,Z) =&amp;gt; on(X,Z).&lt;br /&gt;
on(X,Y) =&amp;gt; below(Y,X).&lt;br /&gt;
on(X,Y) &amp;amp; on(Y,Z) =&amp;gt; on(X,Z).&lt;br /&gt;
&lt;br /&gt;
%questions&lt;br /&gt;
%color(sofa, Color) =&amp;gt; $ans(Color).&lt;br /&gt;
furniture(X) &amp;amp; weight(X, Kaal) &amp;amp; $greatereq(Kaal, 50) =&amp;gt; $ans(X, Kaal).&lt;br /&gt;
%plant(X) &amp;amp; name(X, Name1) &amp;amp; plant(Y) &amp;amp; name(Y, Name2) &amp;amp; Name1!=Name2 =&amp;gt; $ans(X, Name1,Y, Name2).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=KR_2026_homework_part_1&amp;diff=22751</id>
		<title>KR 2026 homework part 1</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=KR_2026_homework_part_1&amp;diff=22751"/>
		<updated>2026-03-03T10:58:47Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Task */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a first draft description of the task. Additional helpful details and examples will be added during February.&lt;br /&gt;
&lt;br /&gt;
== Task ==&lt;br /&gt;
&lt;br /&gt;
You will have to describe the contents of an ordinary room for an intelligent robot who is going to navigate the room and is able to understand what is there, answer questions about the room, etc.&lt;br /&gt;
&lt;br /&gt;
The room has to be described in a formal way. Enhanced with some rules, you should be able to formally find and derive information about the room, like what is higher, what is lower, what is above/below, find objects with some properties, etc. For example: what is above the table? is there a blue chair in the room? is there something weighing more than 100 kg in the room? what is near the blue book?&lt;br /&gt;
&lt;br /&gt;
How to proceed:&lt;br /&gt;
&lt;br /&gt;
* First, take a photo (or better, a few photos) of an ordinary room with a reasonable number of various objects. The photo will be made public. Do not use a room somebody else is using for the same task! You will have to formalize information about the contents of the room, using this photo. &lt;br /&gt;
&lt;br /&gt;
* Second, formalize the contents using a conventional logic format understandable by https://logictools.org/ . You cannot realistically formalize everything in a room: do it to a reasonable, yet interesting level / number of objects described.&lt;br /&gt;
&lt;br /&gt;
* Third, convert the contents to [https://json-ld.org/ json-ld]: the point here is to get some experience with json-ld, not that you really need it for the following steps here (although you can use it with the https://github.com/tammet/json-ld-logic extension).&lt;br /&gt;
&lt;br /&gt;
* Fourth, invent and add sensible common-sense rules about the physical objects in the room. Try to make some rules a little more complex, e.g., make one rule use another rule. &lt;br /&gt;
&lt;br /&gt;
* Fifth, demonstrate how https://logictools.org/ is able to answer (or not) various questions (at least 5) about the room. Both successes and failures are interesting. &lt;br /&gt;
&lt;br /&gt;
Observe that logictools is able to understand a specific json format, which includes a subset of json-ld. See https://logictools.org/json.html , the &amp;quot;examples&amp;quot; selection box and the spec https://github.com/tammet/json-ld-logic for that. Under &amp;quot;Advanced&amp;quot; button you can convert between two representations. NB! This conversion does not convert conventional logic to json-ld. Also, using json-ld directly as a first format for representation might be cumbersone, and logictool has different quirks and limitations handling json-ld directly. In other words, while it makes sense to experiment with logictools with json-ld, use this combo for experimentation, and maybe not as a primary representation format, unless you are brave :)&lt;br /&gt;
&lt;br /&gt;
== Presentation ==&lt;br /&gt;
&lt;br /&gt;
The results of the lab should be shown to Riina during lab time, so she can ask questions and discuss the results and the process.&lt;br /&gt;
&lt;br /&gt;
== LLM policy ==&lt;br /&gt;
&lt;br /&gt;
It is OK to use an LLM, but do &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;not yet show&amp;lt;/font&amp;gt; your room image to an LLM: we will experiment with LLM image handling in later practice tasks.&lt;br /&gt;
&lt;br /&gt;
Also, please add a short information about your llm use to the overview of the results: which LLMs you used, for what and what was the experience.&lt;br /&gt;
&lt;br /&gt;
== Ideas and inspiration ==&lt;br /&gt;
&lt;br /&gt;
For inspiration you may want to have a look at the following relatively complex suggestions of encoding information about rooms and things. Please do not try to use these exactly, just read them for ideas:&lt;br /&gt;
&lt;br /&gt;
* https://docs.brickschema.org/modeling/collections.html&lt;br /&gt;
* https://w3c-lbd-cg.github.io/bot/&lt;br /&gt;
* https://www.w3.org/WoT/&lt;br /&gt;
* https://www.w3.org/TR/2025/WD-wot-thing-description-2.0-20251104/#td-basic-types-mapping&lt;br /&gt;
* http://www.funstep.org/ontology/ | http://www.funstep.org/download/ | Visualiseerimiseks näiteks: https://protege.stanford.edu/&lt;br /&gt;
&lt;br /&gt;
Space and time, fairly complex ideas:&lt;br /&gt;
&lt;br /&gt;
* https://www.irit.fr/publis/LILAC/V-SRR97.pdf&lt;br /&gt;
&lt;br /&gt;
== 10. veebruari harjutus ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nextTo(sofa, lamp).&lt;br /&gt;
nextTo(cabinet, desk).&lt;br /&gt;
nextTo(cabinet, plant1).&lt;br /&gt;
attachedTo(cabinet, hanger).&lt;br /&gt;
on(desk, plant2).&lt;br /&gt;
on(desk, glass).&lt;br /&gt;
on(desk, papers).&lt;br /&gt;
on(papers, phone).&lt;br /&gt;
in(glass, water).&lt;br /&gt;
nextTo(desk, window).&lt;br /&gt;
nextTo(desk, curtains).&lt;br /&gt;
nextTo(window, curtains).&lt;br /&gt;
name(plant1, &amp;quot;Ficus benjamina&amp;quot;).&lt;br /&gt;
name(plant2, &amp;quot;Spathiphyllum&amp;quot;).&lt;br /&gt;
weight(cabinet, 90).&lt;br /&gt;
&lt;br /&gt;
color(sofa, &#039;olive green&#039;).&lt;br /&gt;
color(curtains, blue).&lt;br /&gt;
color(plant1, green).&lt;br /&gt;
color(plant2, green).&lt;br /&gt;
&lt;br /&gt;
plant(plant1).&lt;br /&gt;
plant(plant2).&lt;br /&gt;
&lt;br /&gt;
%rules&lt;br /&gt;
on(X,Y) &amp;amp; in(Y,Z) =&amp;gt; on(X,Z).&lt;br /&gt;
on(X,Y) =&amp;gt; below(Y,X).&lt;br /&gt;
on(X,Y) &amp;amp; on(Y,Z) =&amp;gt; on(X,Z).&lt;br /&gt;
&lt;br /&gt;
%questions&lt;br /&gt;
%color(sofa, Color) =&amp;gt; $ans(Color).&lt;br /&gt;
furniture(X) &amp;amp; weight(X, Kaal) &amp;amp; $greatereq(Kaal, 50) =&amp;gt; $ans(X, Kaal).&lt;br /&gt;
%plant(X) &amp;amp; name(X, Name1) &amp;amp; plant(Y) &amp;amp; name(Y, Name2) &amp;amp; Name1!=Name2 =&amp;gt; $ans(X, Name1,Y, Name2).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22750</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22750"/>
		<updated>2026-03-03T08:26:13Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Time, place, result */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2025|2025]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! 23 ja 24 veebruar on puhkepäevad&amp;lt;/font&amp;gt; =&lt;br /&gt;
Esmaspäev, 23. veebruar (ja ka teisipäev, 24. veebruar) on ülikoolis puhkepäevad ja õppetööd ei toimu.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! Materjalid hetkel uuendamisel&amp;lt;/font&amp;gt; =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Mondays 12:00-13:30 room SOC 414&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Tuesdays 08:00-09:30 room &amp;lt;s&amp;gt;MEK-122&amp;lt;/s&amp;gt; MEK-109.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3A-xXLRsURTirXcCCkQN46w4wYRJaarxbl797KeThtWXY1%40thread.tacv2/conversations?groupId=30b97413-f1b1-404d-8498-b35024d1a002&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams group] of the course. The code for joining is zb3z457.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/33688408323196?p=sd6YBPK9VZ7gRe7Zro teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/3558703223396?p=zc4Lgecwoy1e9Yhav9 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam (10 of these on the page), while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials (20 on the page) will also come up, but less and/or in a simpler form. &lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
== The first weekly task ==&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 17. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjalile [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
client table: id name balance&lt;br /&gt;
1 john 100 &lt;br /&gt;
2 pete -200&lt;br /&gt;
&lt;br /&gt;
cars table: id model owner&lt;br /&gt;
1 ford 1&lt;br /&gt;
2 opel 2&lt;br /&gt;
3 saab 2&lt;br /&gt;
&lt;br /&gt;
select client.name, client.balance&lt;br /&gt;
from client where balance&amp;lt;0&lt;br /&gt;
&lt;br /&gt;
select client.name, cars.model from client, cars&lt;br /&gt;
where client.id=cars.owner&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
* Kasuta kindlasti oma taltech.ee aadressi, sest muidu võib kiri lõpetada rämpspostis!&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The second weekly task ==&lt;br /&gt;
&lt;br /&gt;
Selle ülesande mõte on veidi praktiseerida JSON-LD esitusega. Sinu konkreetne ülesanne on võtta oma esimene nädalaülesanne ja esitada needsamad andmed (ja soovitavalt ka reeglid) JSON-LD kujul.&lt;br /&gt;
&lt;br /&gt;
Vaata alustuseks json-ld näiteid [https://logictools.org/json.html logictoolsi json-tabi alt]. NB! Enamus näiteid &amp;quot;example&amp;quot; valikuboksist ei ole konventsionaalne json-ld, aga mitmed on.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
* Kasuta saatmiseks kindlasti taltech.ee aadressi, sest muidu võib kiri minna rämpspostiks!&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; The plan for practice work is currently being updated. The information below is not up to date yet, except for the first lab, which is already updated for 2026.&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2026 homework part 1|2026 task for the first lab]] is about encoding nontrivial information in various ways (standard logic, rdf, json-ld) and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Deadline: 10. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
&lt;br /&gt;
See [[Details of the KR second lab in 2025]]. There are 5 options, you only have to choose one.&lt;br /&gt;
&lt;br /&gt;
Deadline: 7. April? (may change)&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
&amp;lt;!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Deadline: 12. May&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- We will do live experimenting for the third lab at the April 22 lecture and will then add more interesting parts to the notes above. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NB! The task description above has just been updated (at 23. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin. &amp;lt;!-- [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) --&amp;gt; [https://web.stanford.edu/~jurafsky/slp3/ the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read [https://web.stanford.edu/~jurafsky/slp3/20.pdf chapter 6 about extracting information] and the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/H.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture] --&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2025 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 2. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2026.pdf|teadmised_intro2026.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel] &amp;lt;!--, [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel] --&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 9. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl + reasoner: 16. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
What the reasoner does:&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: DPP ontology development. 2. March ===&lt;br /&gt;
&lt;br /&gt;
Loengu annab Riina. Digital Product Passport (DPP)&lt;br /&gt;
kui näide praktilisest ontoloogia/sõnastiku arendamisest [https://cirpassproject.eu/dpp-in-a-nutshell/ CIRPASS] projektis.&lt;br /&gt;
&lt;br /&gt;
[https://dpp.vocabulary-hub.eu/ Hetkeseisu algusleht]. &lt;br /&gt;
&lt;br /&gt;
[https://cirpass2.eu/ CIRPASS-2]&lt;br /&gt;
&lt;br /&gt;
[https://si-digital-framework.org/SI/units?lang=en Ühikute ontoloogia]&lt;br /&gt;
&lt;br /&gt;
[https://www.w3.org/TR/shacl/ SHACL]&lt;br /&gt;
&lt;br /&gt;
[https://untp.unece.org/docs/specification/DigitalProductPassport/ UNTP DPP]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: märtsi algul ===&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Next homework and looking into main large knowledge bases: 9. March  ===&lt;br /&gt;
&lt;br /&gt;
We will first present the next homework.&lt;br /&gt;
&lt;br /&gt;
Then we will continue with existing large knowledge bases.&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors: 16 March ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors]. &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM) ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_intro.pdf|Lecture material]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning + open/closed world, planning, frame problem, blocks world. 1 April ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;First, some results/challenges in neurosymbolic reasoning.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]&lt;br /&gt;
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]&lt;br /&gt;
* [https://arcprize.org/ arcprize]. See also [https://liusida.github.io/ARC/ ARC v1 for humans], [https://www.youtube.com/watch?v=jSAT_RuJ_Cg MLST about the state of v1 solvers], [https://www.youtube.com/watch?v=M3b59lZYBW8 MLST video introducing ARC v2]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Second, planning, open/closed worlds and the frame problem. &amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Reasoning with uncertainty and intro to lab 3 ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links. In particular, [https://en.wikipedia.org/wiki/Bayesian_inference Wiki on Bayesian inference] and [https://math.mit.edu/~dav/05.dir/class11-prep.pdf this]&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: visual reasoning  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher Mohit Vaishnav. You may want to have a look at his [https://vaishnavmohit.github.io/phd_thesis/ thesis] from 2023.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: third lab live experiments ===&lt;br /&gt;
&lt;br /&gt;
We will do live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
Previous plan was: continue with uncertainty, numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing  ===&lt;br /&gt;
&lt;br /&gt;
The focus of the lecture is on [https://en.wikipedia.org/wiki/Semantic_parsing semantic parsing].&lt;br /&gt;
&lt;br /&gt;
Here are Martin&#039;s slides from 2024 [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
We will look at both (a) classic paradigms of semantic parsing (as on the slides), (b) using LLMs and alternative modern paradigms for semantic parsing.&lt;br /&gt;
&lt;br /&gt;
About important concepts in parsing:&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Part_of_speech Part-Of-Speech (POS)] and [https://en.wikipedia.org/wiki/Part-of-speech_tagging POS tagging]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/18.pdf Jurafsky&amp;amp;Martin: Constituency Parsing]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/19.pdf Jurafsky&amp;amp;Martin: Dependency Parsing]&lt;br /&gt;
&lt;br /&gt;
Some important toolkits and representation schemes:&lt;br /&gt;
* [https://spacy.io spacy], [[a small spacy UD parsing example]]&lt;br /&gt;
* [https://stanfordnlp.github.io/stanza/ stanza]&lt;br /&gt;
* [https://universaldependencies.org/ universal dependencies]&lt;br /&gt;
&lt;br /&gt;
Some draft parsing papers:&lt;br /&gt;
* [[Media:concepts_draft_paper.pdf|concepts, based on UD]]&lt;br /&gt;
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]&lt;br /&gt;
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]&lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued  ===&lt;br /&gt;
&lt;br /&gt;
Lecture will be given by Martin Verrev on teams only (not the lecture room).&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning and consultation for the exam  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22749</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22749"/>
		<updated>2026-03-02T12:06:30Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Lecture: DPP ontology development. 2. March */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2025|2025]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! 23 ja 24 veebruar on puhkepäevad&amp;lt;/font&amp;gt; =&lt;br /&gt;
Esmaspäev, 23. veebruar (ja ka teisipäev, 24. veebruar) on ülikoolis puhkepäevad ja õppetööd ei toimu.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! Materjalid hetkel uuendamisel&amp;lt;/font&amp;gt; =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Mondays 12:00-13:30 room SOC 414&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Tuesdays 08:00-09:30 room MEK-122; in week five, the session will be held in room MEK-109.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3A-xXLRsURTirXcCCkQN46w4wYRJaarxbl797KeThtWXY1%40thread.tacv2/conversations?groupId=30b97413-f1b1-404d-8498-b35024d1a002&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams group] of the course. The code for joining is zb3z457.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/33688408323196?p=sd6YBPK9VZ7gRe7Zro teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/3558703223396?p=zc4Lgecwoy1e9Yhav9 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam (10 of these on the page), while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials (20 on the page) will also come up, but less and/or in a simpler form. &lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
== The first weekly task ==&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 17. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjalile [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
client table: id name balance&lt;br /&gt;
1 john 100 &lt;br /&gt;
2 pete -200&lt;br /&gt;
&lt;br /&gt;
cars table: id model owner&lt;br /&gt;
1 ford 1&lt;br /&gt;
2 opel 2&lt;br /&gt;
3 saab 2&lt;br /&gt;
&lt;br /&gt;
select client.name, client.balance&lt;br /&gt;
from client where balance&amp;lt;0&lt;br /&gt;
&lt;br /&gt;
select client.name, cars.model from client, cars&lt;br /&gt;
where client.id=cars.owner&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
* Kasuta kindlasti oma taltech.ee aadressi, sest muidu võib kiri lõpetada rämpspostis!&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The second weekly task ==&lt;br /&gt;
&lt;br /&gt;
Selle ülesande mõte on veidi praktiseerida JSON-LD esitusega. Sinu konkreetne ülesanne on võtta oma esimene nädalaülesanne ja esitada needsamad andmed (ja soovitavalt ka reeglid) JSON-LD kujul.&lt;br /&gt;
&lt;br /&gt;
Vaata alustuseks json-ld näiteid [https://logictools.org/json.html logictoolsi json-tabi alt]. NB! Enamus näiteid &amp;quot;example&amp;quot; valikuboksist ei ole konventsionaalne json-ld, aga mitmed on.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
* Kasuta saatmiseks kindlasti taltech.ee aadressi, sest muidu võib kiri minna rämpspostiks!&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; The plan for practice work is currently being updated. The information below is not up to date yet, except for the first lab, which is already updated for 2026.&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2026 homework part 1|2026 task for the first lab]] is about encoding nontrivial information in various ways (standard logic, rdf, json-ld) and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Deadline: 10. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
&lt;br /&gt;
See [[Details of the KR second lab in 2025]]. There are 5 options, you only have to choose one.&lt;br /&gt;
&lt;br /&gt;
Deadline: 7. April? (may change)&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
&amp;lt;!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Deadline: 12. May&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- We will do live experimenting for the third lab at the April 22 lecture and will then add more interesting parts to the notes above. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NB! The task description above has just been updated (at 23. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin. &amp;lt;!-- [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) --&amp;gt; [https://web.stanford.edu/~jurafsky/slp3/ the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read [https://web.stanford.edu/~jurafsky/slp3/20.pdf chapter 6 about extracting information] and the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/H.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture] --&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2025 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 2. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2026.pdf|teadmised_intro2026.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel] &amp;lt;!--, [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel] --&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 9. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl + reasoner: 16. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
What the reasoner does:&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: DPP ontology development. 2. March ===&lt;br /&gt;
&lt;br /&gt;
Loengu annab Riina. Digital Product Passport (DPP)&lt;br /&gt;
kui näide praktilisest ontoloogia/sõnastiku arendamisest [https://cirpassproject.eu/dpp-in-a-nutshell/ CIRPASS] projektis.&lt;br /&gt;
&lt;br /&gt;
[https://dpp.vocabulary-hub.eu/ Hetkeseisu algusleht]. &lt;br /&gt;
&lt;br /&gt;
[https://cirpass2.eu/ CIRPASS-2]&lt;br /&gt;
&lt;br /&gt;
[https://si-digital-framework.org/SI/units?lang=en Ühikute ontoloogia]&lt;br /&gt;
&lt;br /&gt;
[https://www.w3.org/TR/shacl/ SHACL]&lt;br /&gt;
&lt;br /&gt;
[https://untp.unece.org/docs/specification/DigitalProductPassport/ UNTP DPP]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: märtsi algul ===&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Next homework and looking into main large knowledge bases: 9. March  ===&lt;br /&gt;
&lt;br /&gt;
We will first present the next homework.&lt;br /&gt;
&lt;br /&gt;
Then we will continue with existing large knowledge bases.&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors: 16 March ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors]. &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM) ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_intro.pdf|Lecture material]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning + open/closed world, planning, frame problem, blocks world. 1 April ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;First, some results/challenges in neurosymbolic reasoning.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]&lt;br /&gt;
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]&lt;br /&gt;
* [https://arcprize.org/ arcprize]. See also [https://liusida.github.io/ARC/ ARC v1 for humans], [https://www.youtube.com/watch?v=jSAT_RuJ_Cg MLST about the state of v1 solvers], [https://www.youtube.com/watch?v=M3b59lZYBW8 MLST video introducing ARC v2]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Second, planning, open/closed worlds and the frame problem. &amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Reasoning with uncertainty and intro to lab 3 ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links. In particular, [https://en.wikipedia.org/wiki/Bayesian_inference Wiki on Bayesian inference] and [https://math.mit.edu/~dav/05.dir/class11-prep.pdf this]&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: visual reasoning  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher Mohit Vaishnav. You may want to have a look at his [https://vaishnavmohit.github.io/phd_thesis/ thesis] from 2023.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: third lab live experiments ===&lt;br /&gt;
&lt;br /&gt;
We will do live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
Previous plan was: continue with uncertainty, numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing  ===&lt;br /&gt;
&lt;br /&gt;
The focus of the lecture is on [https://en.wikipedia.org/wiki/Semantic_parsing semantic parsing].&lt;br /&gt;
&lt;br /&gt;
Here are Martin&#039;s slides from 2024 [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
We will look at both (a) classic paradigms of semantic parsing (as on the slides), (b) using LLMs and alternative modern paradigms for semantic parsing.&lt;br /&gt;
&lt;br /&gt;
About important concepts in parsing:&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Part_of_speech Part-Of-Speech (POS)] and [https://en.wikipedia.org/wiki/Part-of-speech_tagging POS tagging]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/18.pdf Jurafsky&amp;amp;Martin: Constituency Parsing]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/19.pdf Jurafsky&amp;amp;Martin: Dependency Parsing]&lt;br /&gt;
&lt;br /&gt;
Some important toolkits and representation schemes:&lt;br /&gt;
* [https://spacy.io spacy], [[a small spacy UD parsing example]]&lt;br /&gt;
* [https://stanfordnlp.github.io/stanza/ stanza]&lt;br /&gt;
* [https://universaldependencies.org/ universal dependencies]&lt;br /&gt;
&lt;br /&gt;
Some draft parsing papers:&lt;br /&gt;
* [[Media:concepts_draft_paper.pdf|concepts, based on UD]]&lt;br /&gt;
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]&lt;br /&gt;
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]&lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued  ===&lt;br /&gt;
&lt;br /&gt;
Lecture will be given by Martin Verrev on teams only (not the lecture room).&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning and consultation for the exam  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=KR_2026_homework_part_1&amp;diff=22718</id>
		<title>KR 2026 homework part 1</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=KR_2026_homework_part_1&amp;diff=22718"/>
		<updated>2026-02-20T05:49:24Z</updated>

		<summary type="html">&lt;p&gt;Riina: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a first draft description of the task. Additional helpful details and examples will be added during February.&lt;br /&gt;
&lt;br /&gt;
== Task ==&lt;br /&gt;
&lt;br /&gt;
You will have to describe the contents of an ordinary room for an intelligent robot who is going to navigate the room and is able to understand what is there, answer questions about the room, etc.&lt;br /&gt;
&lt;br /&gt;
The room has to be described in a formal way. Enhanced with some rules, you should be able to formally find and derive information about the room, like what is higher, what is lower, what is above/below, find objects with some properties, etc. For example: what is above the table? is there a blue chair in the room? is there something weighing more than 100 kg in the room? what is near the blue book?&lt;br /&gt;
&lt;br /&gt;
How to proceed:&lt;br /&gt;
&lt;br /&gt;
* First, take a photo (or better, a few photos) of an ordinary room with a reasonable number of various objects. The photo will be made public. Do not use a room somebody else is using for the same task! You will have to formalize information about the contents of the room, using this photo. &lt;br /&gt;
&lt;br /&gt;
* Second, formalize the contents using a conventional logic format understandable by https://logictools.org/ . You cannot realistically formalize everything in a room: do it to a reasonable, yet interesting level / number of objects described.&lt;br /&gt;
&lt;br /&gt;
* Third, convert the contents to [https://json-ld.org/ json-ld]: the point here is to get some experience with json-ld, not that you really need it for the following steps here (although you can use it with the https://github.com/tammet/json-ld-logic extension).&lt;br /&gt;
&lt;br /&gt;
* Fourth, invent and add sensible common-sense rules about the physical objects in the room.&lt;br /&gt;
&lt;br /&gt;
* Fifth, demonstrate how https://logictools.org/ is able to answer (or not) various questions (at least 5) about the room. Both successes and failures are interesting. &lt;br /&gt;
&lt;br /&gt;
Observe that logictools is able to understand a specific json format, which includes a subset of json-ld. See https://logictools.org/json.html , the &amp;quot;examples&amp;quot; selection box and the spec https://github.com/tammet/json-ld-logic for that. Under &amp;quot;Advanced&amp;quot; button you can convert between two representations. NB! This conversion does not convert conventional logic to json-ld. Also, using json-ld directly as a first format for representation might be cumbersone, and logictool has different quirks and limitations handling json-ld directly. In other words, while it makes sense to experiment with logictools with json-ld, use this combo for experimentation, and maybe not as a primary representation format, unless you are brave :)&lt;br /&gt;
&lt;br /&gt;
== Presentation ==&lt;br /&gt;
&lt;br /&gt;
The results of the lab should be shown to Riina during lab time, so she can ask questions and discuss the results and the process.&lt;br /&gt;
&lt;br /&gt;
== LLM policy ==&lt;br /&gt;
&lt;br /&gt;
It is OK to use an LLM, but do &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;not yet show&amp;lt;/font&amp;gt; your room image to an LLM: we will experiment with LLM image handling in later practice tasks.&lt;br /&gt;
&lt;br /&gt;
Also, please add a short information about your llm use to the overview of the results: which LLMs you used, for what and what was the experience.&lt;br /&gt;
&lt;br /&gt;
== Ideas and inspiration ==&lt;br /&gt;
&lt;br /&gt;
For inspiration you may want to have a look at the following relatively complex suggestions of encoding information about rooms and things. Please do not try to use these exactly, just read them for ideas:&lt;br /&gt;
&lt;br /&gt;
* https://docs.brickschema.org/modeling/collections.html&lt;br /&gt;
* https://w3c-lbd-cg.github.io/bot/&lt;br /&gt;
* https://www.w3.org/WoT/&lt;br /&gt;
* https://www.w3.org/TR/2025/WD-wot-thing-description-2.0-20251104/#td-basic-types-mapping&lt;br /&gt;
* http://www.funstep.org/ontology/ | http://www.funstep.org/download/ | Visualiseerimiseks näiteks: https://protege.stanford.edu/&lt;br /&gt;
&lt;br /&gt;
Space and time, fairly complex ideas:&lt;br /&gt;
&lt;br /&gt;
* https://www.irit.fr/publis/LILAC/V-SRR97.pdf&lt;br /&gt;
&lt;br /&gt;
== 10. veebruari harjutus ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nextTo(sofa, lamp).&lt;br /&gt;
nextTo(cabinet, desk).&lt;br /&gt;
nextTo(cabinet, plant1).&lt;br /&gt;
attachedTo(cabinet, hanger).&lt;br /&gt;
on(desk, plant2).&lt;br /&gt;
on(desk, glass).&lt;br /&gt;
on(desk, papers).&lt;br /&gt;
on(papers, phone).&lt;br /&gt;
in(glass, water).&lt;br /&gt;
nextTo(desk, window).&lt;br /&gt;
nextTo(desk, curtains).&lt;br /&gt;
nextTo(window, curtains).&lt;br /&gt;
name(plant1, &amp;quot;Ficus benjamina&amp;quot;).&lt;br /&gt;
name(plant2, &amp;quot;Spathiphyllum&amp;quot;).&lt;br /&gt;
weight(cabinet, 90).&lt;br /&gt;
&lt;br /&gt;
color(sofa, &#039;olive green&#039;).&lt;br /&gt;
color(curtains, blue).&lt;br /&gt;
color(plant1, green).&lt;br /&gt;
color(plant2, green).&lt;br /&gt;
&lt;br /&gt;
plant(plant1).&lt;br /&gt;
plant(plant2).&lt;br /&gt;
&lt;br /&gt;
%rules&lt;br /&gt;
on(X,Y) &amp;amp; in(Y,Z) =&amp;gt; on(X,Z).&lt;br /&gt;
on(X,Y) =&amp;gt; below(Y,X).&lt;br /&gt;
on(X,Y) &amp;amp; on(Y,Z) =&amp;gt; on(X,Z).&lt;br /&gt;
&lt;br /&gt;
%questions&lt;br /&gt;
%color(sofa, Color) =&amp;gt; $ans(Color).&lt;br /&gt;
furniture(X) &amp;amp; weight(X, Kaal) &amp;amp; $greatereq(Kaal, 50) =&amp;gt; $ans(X, Kaal).&lt;br /&gt;
%plant(X) &amp;amp; name(X, Name1) &amp;amp; plant(Y) &amp;amp; name(Y, Name2) &amp;amp; Name1!=Name2 =&amp;gt; $ans(X, Name1,Y, Name2).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=KR_2026_homework_part_1&amp;diff=22711</id>
		<title>KR 2026 homework part 1</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=KR_2026_homework_part_1&amp;diff=22711"/>
		<updated>2026-02-16T09:20:23Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Ideas and inspiration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a first draft description of the task. Additional helpful details and examples will be added during February.&lt;br /&gt;
&lt;br /&gt;
== Task ==&lt;br /&gt;
&lt;br /&gt;
You will have to describe the contents of an ordinary room for an intelligent robot who is going to navigate the room and is able to understand what is there, answer questions about the room, etc.&lt;br /&gt;
&lt;br /&gt;
The room has to be described in a formal way. Enhanced with some rules, you should be able to formally find and derive information about the room, like what is higher, what is lower, what is above/below, find objects with some properties, etc. For example: what is above the table? is there a blue chair in the room? is there something weighing more than 100 kg in the room? what is near the blue book?&lt;br /&gt;
&lt;br /&gt;
How to proceed:&lt;br /&gt;
&lt;br /&gt;
* First, take a photo (or better, a few photos) of an ordinary room with a reasonable number of various objects. The photo will be made public. Do not use a room somebody else is using for the same task! You will have to formalize information about the contents of the room, using this photo. &lt;br /&gt;
&lt;br /&gt;
* Second, formalize the contents using a conventional logic format understandable by https://logictools.org/ . You cannot realistically formalize everything in a room: do it to a reasonable, yet interesting level / number of objects described.&lt;br /&gt;
&lt;br /&gt;
* Third, convert the contents to [https://json-ld.org/ json-ld]: the point here is to get some experience with json-ld, not that you really need it for the following steps here (although you can use it with the https://github.com/tammet/json-ld-logic extension).&lt;br /&gt;
&lt;br /&gt;
* Fourth, invent and add sensible common-sense rules about the physical objects in the room.&lt;br /&gt;
&lt;br /&gt;
* Fifth, demonstrate how https://logictools.org/ is able to answer (or not) various questions about the room. Both successes and failures are interesting.&lt;br /&gt;
&lt;br /&gt;
Observe that logictools is able to understand a specific json format, which includes a subset of json-ld. See https://logictools.org/json.html , the &amp;quot;examples&amp;quot; selection box and the spec https://github.com/tammet/json-ld-logic for that. Under &amp;quot;Advanced&amp;quot; button you can convert between two representations. NB! This conversion does not convert conventional logic to json-ld. Also, using json-ld directly as a first format for representation might be cumbersone, and logictool has different quirks and limitations handling json-ld directly. In other words, while it makes sense to experiment with logictools with json-ld, use this combo for experimentation, and maybe not as a primary representation format, unless you are brave :)&lt;br /&gt;
&lt;br /&gt;
== Presentation ==&lt;br /&gt;
&lt;br /&gt;
The results of the lab should be shown to Riina during lab time, so she can ask questions and discuss the results and the process.&lt;br /&gt;
&lt;br /&gt;
== LLM policy ==&lt;br /&gt;
&lt;br /&gt;
It is OK to use an LLM, but do &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;not yet show&amp;lt;/font&amp;gt; your room image to an LLM: we will experiment with LLM image handling in later practice tasks.&lt;br /&gt;
&lt;br /&gt;
Also, please add a short information about your llm use to the overview of the results: which LLMs you used, for what and what was the experience.&lt;br /&gt;
&lt;br /&gt;
== Ideas and inspiration ==&lt;br /&gt;
&lt;br /&gt;
For inspiration you may want to have a look at the following relatively complex suggestions of encoding information about rooms and things. Please do not try to use these exactly, just read them for ideas:&lt;br /&gt;
&lt;br /&gt;
* https://docs.brickschema.org/modeling/collections.html&lt;br /&gt;
* https://w3c-lbd-cg.github.io/bot/&lt;br /&gt;
* https://www.w3.org/WoT/&lt;br /&gt;
* https://www.w3.org/TR/2025/WD-wot-thing-description-2.0-20251104/#td-basic-types-mapping&lt;br /&gt;
* http://www.funstep.org/ontology/ | http://www.funstep.org/download/ | Visualiseerimiseks näiteks: https://protege.stanford.edu/&lt;br /&gt;
&lt;br /&gt;
Space and time, fairly complex ideas:&lt;br /&gt;
&lt;br /&gt;
* https://www.irit.fr/publis/LILAC/V-SRR97.pdf&lt;br /&gt;
&lt;br /&gt;
== 10. veebruari harjutus ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nextTo(sofa, lamp).&lt;br /&gt;
nextTo(cabinet, desk).&lt;br /&gt;
nextTo(cabinet, plant1).&lt;br /&gt;
attachedTo(cabinet, hanger).&lt;br /&gt;
on(desk, plant2).&lt;br /&gt;
on(desk, glass).&lt;br /&gt;
on(desk, papers).&lt;br /&gt;
on(papers, phone).&lt;br /&gt;
in(glass, water).&lt;br /&gt;
nextTo(desk, window).&lt;br /&gt;
nextTo(desk, curtains).&lt;br /&gt;
nextTo(window, curtains).&lt;br /&gt;
name(plant1, &amp;quot;Ficus benjamina&amp;quot;).&lt;br /&gt;
name(plant2, &amp;quot;Spathiphyllum&amp;quot;).&lt;br /&gt;
weight(cabinet, 90).&lt;br /&gt;
&lt;br /&gt;
color(sofa, &#039;olive green&#039;).&lt;br /&gt;
color(curtains, blue).&lt;br /&gt;
color(plant1, green).&lt;br /&gt;
color(plant2, green).&lt;br /&gt;
&lt;br /&gt;
plant(plant1).&lt;br /&gt;
plant(plant2).&lt;br /&gt;
&lt;br /&gt;
%rules&lt;br /&gt;
on(X,Y) &amp;amp; in(Y,Z) =&amp;gt; on(X,Z).&lt;br /&gt;
on(X,Y) =&amp;gt; below(Y,X).&lt;br /&gt;
on(X,Y) &amp;amp; on(Y,Z) =&amp;gt; on(X,Z).&lt;br /&gt;
&lt;br /&gt;
%questions&lt;br /&gt;
%color(sofa, Color) =&amp;gt; $ans(Color).&lt;br /&gt;
furniture(X) &amp;amp; weight(X, Kaal) &amp;amp; $greatereq(Kaal, 50) =&amp;gt; $ans(X, Kaal).&lt;br /&gt;
%plant(X) &amp;amp; name(X, Name1) &amp;amp; plant(Y) &amp;amp; name(Y, Name2) &amp;amp; Name1!=Name2 =&amp;gt; $ans(X, Name1,Y, Name2).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22706</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22706"/>
		<updated>2026-02-11T07:01:09Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Second lab */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2025|2025]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! Materjalid hetkel uuendamisel&amp;lt;/font&amp;gt; =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Mondays 12:00-13:30 room SOC 414&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Tuesdays 08:00-09:30 room MEK-122; in week five, the session will be held in room MEK-109.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3A-xXLRsURTirXcCCkQN46w4wYRJaarxbl797KeThtWXY1%40thread.tacv2/conversations?groupId=30b97413-f1b1-404d-8498-b35024d1a002&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams group] of the course. The code for joining is zb3z457.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/33688408323196?p=sd6YBPK9VZ7gRe7Zro teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/3558703223396?p=zc4Lgecwoy1e9Yhav9 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam (10 of these on the page), while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials (20 on the page) will also come up, but less and/or in a simpler form. &lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
== The first weekly task ==&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 17. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjalile [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
client table: id name balance&lt;br /&gt;
1 john 100 &lt;br /&gt;
2 pete -200&lt;br /&gt;
&lt;br /&gt;
cars table: id model owner&lt;br /&gt;
1 ford 1&lt;br /&gt;
2 opel 2&lt;br /&gt;
3 saab 2&lt;br /&gt;
&lt;br /&gt;
select client.name, client.balance&lt;br /&gt;
from client where balance&amp;lt;0&lt;br /&gt;
&lt;br /&gt;
select client.name, cars.model from client, cars&lt;br /&gt;
where client.id=cars.owner&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
* Kasuta kindlasti oma taltech.ee aadressi, sest muidu võib kiri lõpetada rämpspostis!&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
* Kasuta saatmiseks kindlasti taltech.ee aadressi, sest muidu võib kiri minna rämpspostiks!&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; The plan for practice work is currently being updated. The information below is not up to date yet, except for the first lab, which is already updated for 2026.&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2026 homework part 1|2026 task for the first lab]] is about encoding nontrivial information in various ways (standard logic, rdf, json-ld) and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Deadline: 10. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
&lt;br /&gt;
See [[Details of the KR second lab in 2025]]. There are 5 options, you only have to choose one.&lt;br /&gt;
&lt;br /&gt;
Deadline: 7. April? (may change)&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
&amp;lt;!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Deadline: 12. May&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- We will do live experimenting for the third lab at the April 22 lecture and will then add more interesting parts to the notes above. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NB! The task description above has just been updated (at 23. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin. &amp;lt;!-- [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) --&amp;gt; [https://web.stanford.edu/~jurafsky/slp3/ the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read [https://web.stanford.edu/~jurafsky/slp3/20.pdf chapter 6 about extracting information] and the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/H.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture] --&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2025 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 2. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2026.pdf|teadmised_intro2026.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel] &amp;lt;!--, [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel] --&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 9. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl: 16. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: 23. February ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: looking into main large knowledge bases  ===&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors]. &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM) ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_intro.pdf|Lecture material]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning + open/closed world, planning, frame problem, blocks world. 1 April ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;First, some results/challenges in neurosymbolic reasoning.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]&lt;br /&gt;
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]&lt;br /&gt;
* [https://arcprize.org/ arcprize]. See also [https://liusida.github.io/ARC/ ARC v1 for humans], [https://www.youtube.com/watch?v=jSAT_RuJ_Cg MLST about the state of v1 solvers], [https://www.youtube.com/watch?v=M3b59lZYBW8 MLST video introducing ARC v2]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Second, planning, open/closed worlds and the frame problem. &amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Reasoning with uncertainty and intro to lab 3 ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links. In particular, [https://en.wikipedia.org/wiki/Bayesian_inference Wiki on Bayesian inference] and [https://math.mit.edu/~dav/05.dir/class11-prep.pdf this]&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: visual reasoning  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher Mohit Vaishnav. You may want to have a look at his [https://vaishnavmohit.github.io/phd_thesis/ thesis] from 2023.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: third lab live experiments ===&lt;br /&gt;
&lt;br /&gt;
We will do live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
Previous plan was: continue with uncertainty, numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing  ===&lt;br /&gt;
&lt;br /&gt;
The focus of the lecture is on [https://en.wikipedia.org/wiki/Semantic_parsing semantic parsing].&lt;br /&gt;
&lt;br /&gt;
Here are Martin&#039;s slides from 2024 [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
We will look at both (a) classic paradigms of semantic parsing (as on the slides), (b) using LLMs and alternative modern paradigms for semantic parsing.&lt;br /&gt;
&lt;br /&gt;
About important concepts in parsing:&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Part_of_speech Part-Of-Speech (POS)] and [https://en.wikipedia.org/wiki/Part-of-speech_tagging POS tagging]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/18.pdf Jurafsky&amp;amp;Martin: Constituency Parsing]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/19.pdf Jurafsky&amp;amp;Martin: Dependency Parsing]&lt;br /&gt;
&lt;br /&gt;
Some important toolkits and representation schemes:&lt;br /&gt;
* [https://spacy.io spacy], [[a small spacy UD parsing example]]&lt;br /&gt;
* [https://stanfordnlp.github.io/stanza/ stanza]&lt;br /&gt;
* [https://universaldependencies.org/ universal dependencies]&lt;br /&gt;
&lt;br /&gt;
Some draft parsing papers:&lt;br /&gt;
* [[Media:concepts_draft_paper.pdf|concepts, based on UD]]&lt;br /&gt;
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]&lt;br /&gt;
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]&lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued  ===&lt;br /&gt;
&lt;br /&gt;
Lecture will be given by Martin Verrev on teams only (not the lecture room).&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning and consultation for the exam  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22705</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22705"/>
		<updated>2026-02-10T10:02:20Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* The first weekly task */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2025|2025]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! Materjalid hetkel uuendamisel&amp;lt;/font&amp;gt; =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Mondays 12:00-13:30 room SOC 414&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Tuesdays 08:00-09:30 room MEK-122; in week five, the session will be held in room MEK-109.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3A-xXLRsURTirXcCCkQN46w4wYRJaarxbl797KeThtWXY1%40thread.tacv2/conversations?groupId=30b97413-f1b1-404d-8498-b35024d1a002&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams group] of the course. The code for joining is zb3z457.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/33688408323196?p=sd6YBPK9VZ7gRe7Zro teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/3558703223396?p=zc4Lgecwoy1e9Yhav9 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam (10 of these on the page), while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials (20 on the page) will also come up, but less and/or in a simpler form. &lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
== The first weekly task ==&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 17. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjalile [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
client table: id name balance&lt;br /&gt;
1 john 100 &lt;br /&gt;
2 pete -200&lt;br /&gt;
&lt;br /&gt;
cars table: id model owner&lt;br /&gt;
1 ford 1&lt;br /&gt;
2 opel 2&lt;br /&gt;
3 saab 2&lt;br /&gt;
&lt;br /&gt;
select client.name, client.balance&lt;br /&gt;
from client where balance&amp;lt;0&lt;br /&gt;
&lt;br /&gt;
select client.name, cars.model from client, cars&lt;br /&gt;
where client.id=cars.owner&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
* Kasuta kindlasti oma taltech.ee aadressi, sest muidu võib kiri lõpetada rämpspostis!&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
* Kasuta saatmiseks kindlasti taltech.ee aadressi, sest muidu võib kiri minna rämpspostiks!&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; The plan for practice work is currently being updated. The information below is not up to date yet, except for the first lab, which is already updated for 2026.&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2026 homework part 1|2026 task for the first lab]] is about encoding nontrivial information in various ways (standard logic, rdf, json-ld) and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Deadline: 10. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
&lt;br /&gt;
See [[Details of the KR second lab in 2025]]. There are 5 options, you only have to choose one.&lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change. &lt;br /&gt;
&lt;br /&gt;
Deadline: 7. April? (may change)&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
&amp;lt;!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Deadline: 12. May&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- We will do live experimenting for the third lab at the April 22 lecture and will then add more interesting parts to the notes above. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NB! The task description above has just been updated (at 23. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin. &amp;lt;!-- [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) --&amp;gt; [https://web.stanford.edu/~jurafsky/slp3/ the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read [https://web.stanford.edu/~jurafsky/slp3/20.pdf chapter 6 about extracting information] and the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/H.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture] --&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2025 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 2. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2026.pdf|teadmised_intro2026.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel] &amp;lt;!--, [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel] --&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 9. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl: 16. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: 23. February ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: looking into main large knowledge bases  ===&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors]. &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM) ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_intro.pdf|Lecture material]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning + open/closed world, planning, frame problem, blocks world. 1 April ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;First, some results/challenges in neurosymbolic reasoning.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]&lt;br /&gt;
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]&lt;br /&gt;
* [https://arcprize.org/ arcprize]. See also [https://liusida.github.io/ARC/ ARC v1 for humans], [https://www.youtube.com/watch?v=jSAT_RuJ_Cg MLST about the state of v1 solvers], [https://www.youtube.com/watch?v=M3b59lZYBW8 MLST video introducing ARC v2]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Second, planning, open/closed worlds and the frame problem. &amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Reasoning with uncertainty and intro to lab 3 ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links. In particular, [https://en.wikipedia.org/wiki/Bayesian_inference Wiki on Bayesian inference] and [https://math.mit.edu/~dav/05.dir/class11-prep.pdf this]&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: visual reasoning  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher Mohit Vaishnav. You may want to have a look at his [https://vaishnavmohit.github.io/phd_thesis/ thesis] from 2023.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: third lab live experiments ===&lt;br /&gt;
&lt;br /&gt;
We will do live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
Previous plan was: continue with uncertainty, numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing  ===&lt;br /&gt;
&lt;br /&gt;
The focus of the lecture is on [https://en.wikipedia.org/wiki/Semantic_parsing semantic parsing].&lt;br /&gt;
&lt;br /&gt;
Here are Martin&#039;s slides from 2024 [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
We will look at both (a) classic paradigms of semantic parsing (as on the slides), (b) using LLMs and alternative modern paradigms for semantic parsing.&lt;br /&gt;
&lt;br /&gt;
About important concepts in parsing:&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Part_of_speech Part-Of-Speech (POS)] and [https://en.wikipedia.org/wiki/Part-of-speech_tagging POS tagging]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/18.pdf Jurafsky&amp;amp;Martin: Constituency Parsing]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/19.pdf Jurafsky&amp;amp;Martin: Dependency Parsing]&lt;br /&gt;
&lt;br /&gt;
Some important toolkits and representation schemes:&lt;br /&gt;
* [https://spacy.io spacy], [[a small spacy UD parsing example]]&lt;br /&gt;
* [https://stanfordnlp.github.io/stanza/ stanza]&lt;br /&gt;
* [https://universaldependencies.org/ universal dependencies]&lt;br /&gt;
&lt;br /&gt;
Some draft parsing papers:&lt;br /&gt;
* [[Media:concepts_draft_paper.pdf|concepts, based on UD]]&lt;br /&gt;
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]&lt;br /&gt;
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]&lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued  ===&lt;br /&gt;
&lt;br /&gt;
Lecture will be given by Martin Verrev on teams only (not the lecture room).&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning and consultation for the exam  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22704</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22704"/>
		<updated>2026-02-10T09:58:16Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* The first weekly task */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2025|2025]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! Materjalid hetkel uuendamisel&amp;lt;/font&amp;gt; =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Mondays 12:00-13:30 room SOC 414&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Tuesdays 08:00-09:30 room MEK-122; in week five, the session will be held in room MEK-109.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3A-xXLRsURTirXcCCkQN46w4wYRJaarxbl797KeThtWXY1%40thread.tacv2/conversations?groupId=30b97413-f1b1-404d-8498-b35024d1a002&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams group] of the course. The code for joining is zb3z457.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/33688408323196?p=sd6YBPK9VZ7gRe7Zro teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/3558703223396?p=zc4Lgecwoy1e9Yhav9 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam (10 of these on the page), while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials (20 on the page) will also come up, but less and/or in a simpler form. &lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
== The first weekly task ==&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 17. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjalile [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
client table: id name balance&lt;br /&gt;
1 john 100 &lt;br /&gt;
2 pete -200&lt;br /&gt;
&lt;br /&gt;
cars table: id model owner&lt;br /&gt;
1 ford 1&lt;br /&gt;
2 opel 2&lt;br /&gt;
3 saab 2&lt;br /&gt;
&lt;br /&gt;
select client.name, client.balance&lt;br /&gt;
from client where balance&amp;lt;0&lt;br /&gt;
&lt;br /&gt;
select client.name, cars.model from client, cars&lt;br /&gt;
where client.id=cars.owner&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
* Kasuta saatmiseks kindlasti taltech.ee aadressi, sest muidu võib kiri minna rämpspostiks!&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; The plan for practice work is currently being updated. The information below is not up to date yet, except for the first lab, which is already updated for 2026.&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2026 homework part 1|2026 task for the first lab]] is about encoding nontrivial information in various ways (standard logic, rdf, json-ld) and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Deadline: 10. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
&lt;br /&gt;
See [[Details of the KR second lab in 2025]]. There are 5 options, you only have to choose one.&lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change. &lt;br /&gt;
&lt;br /&gt;
Deadline: 7. April? (may change)&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
&amp;lt;!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Deadline: 12. May&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- We will do live experimenting for the third lab at the April 22 lecture and will then add more interesting parts to the notes above. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NB! The task description above has just been updated (at 23. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin. &amp;lt;!-- [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) --&amp;gt; [https://web.stanford.edu/~jurafsky/slp3/ the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read [https://web.stanford.edu/~jurafsky/slp3/20.pdf chapter 6 about extracting information] and the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/H.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture] --&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2025 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 2. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2026.pdf|teadmised_intro2026.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel] &amp;lt;!--, [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel] --&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 9. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl: 16. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: 23. February ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: looking into main large knowledge bases  ===&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors]. &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM) ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_intro.pdf|Lecture material]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning + open/closed world, planning, frame problem, blocks world. 1 April ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;First, some results/challenges in neurosymbolic reasoning.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]&lt;br /&gt;
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]&lt;br /&gt;
* [https://arcprize.org/ arcprize]. See also [https://liusida.github.io/ARC/ ARC v1 for humans], [https://www.youtube.com/watch?v=jSAT_RuJ_Cg MLST about the state of v1 solvers], [https://www.youtube.com/watch?v=M3b59lZYBW8 MLST video introducing ARC v2]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Second, planning, open/closed worlds and the frame problem. &amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Reasoning with uncertainty and intro to lab 3 ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links. In particular, [https://en.wikipedia.org/wiki/Bayesian_inference Wiki on Bayesian inference] and [https://math.mit.edu/~dav/05.dir/class11-prep.pdf this]&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: visual reasoning  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher Mohit Vaishnav. You may want to have a look at his [https://vaishnavmohit.github.io/phd_thesis/ thesis] from 2023.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: third lab live experiments ===&lt;br /&gt;
&lt;br /&gt;
We will do live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
Previous plan was: continue with uncertainty, numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing  ===&lt;br /&gt;
&lt;br /&gt;
The focus of the lecture is on [https://en.wikipedia.org/wiki/Semantic_parsing semantic parsing].&lt;br /&gt;
&lt;br /&gt;
Here are Martin&#039;s slides from 2024 [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
We will look at both (a) classic paradigms of semantic parsing (as on the slides), (b) using LLMs and alternative modern paradigms for semantic parsing.&lt;br /&gt;
&lt;br /&gt;
About important concepts in parsing:&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Part_of_speech Part-Of-Speech (POS)] and [https://en.wikipedia.org/wiki/Part-of-speech_tagging POS tagging]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/18.pdf Jurafsky&amp;amp;Martin: Constituency Parsing]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/19.pdf Jurafsky&amp;amp;Martin: Dependency Parsing]&lt;br /&gt;
&lt;br /&gt;
Some important toolkits and representation schemes:&lt;br /&gt;
* [https://spacy.io spacy], [[a small spacy UD parsing example]]&lt;br /&gt;
* [https://stanfordnlp.github.io/stanza/ stanza]&lt;br /&gt;
* [https://universaldependencies.org/ universal dependencies]&lt;br /&gt;
&lt;br /&gt;
Some draft parsing papers:&lt;br /&gt;
* [[Media:concepts_draft_paper.pdf|concepts, based on UD]]&lt;br /&gt;
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]&lt;br /&gt;
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]&lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued  ===&lt;br /&gt;
&lt;br /&gt;
Lecture will be given by Martin Verrev on teams only (not the lecture room).&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning and consultation for the exam  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=KR_2026_homework_part_1&amp;diff=22703</id>
		<title>KR 2026 homework part 1</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=KR_2026_homework_part_1&amp;diff=22703"/>
		<updated>2026-02-10T08:30:42Z</updated>

		<summary type="html">&lt;p&gt;Riina: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a first draft description of the task. Additional helpful details and examples will be added during February.&lt;br /&gt;
&lt;br /&gt;
== Task ==&lt;br /&gt;
&lt;br /&gt;
You will have to describe the contents of an ordinary room for an intelligent robot who is going to navigate the room and is able to understand what is there, answer questions about the room, etc.&lt;br /&gt;
&lt;br /&gt;
The room has to be described in a formal way. Enhanced with some rules, you should be able to formally find and derive information about the room, like what is higher, what is lower, what is above/below, find objects with some properties, etc. For example: what is above the table? is there a blue chair in the room? is there something weighing more than 100 kg in the room? what is near the blue book?&lt;br /&gt;
&lt;br /&gt;
How to proceed:&lt;br /&gt;
&lt;br /&gt;
* First, take a photo (or better, a few photos) of an ordinary room with a reasonable number of various objects. The photo will be made public. Do not use a room somebody else is using for the same task! You will have to formalize information about the contents of the room, using this photo. &lt;br /&gt;
&lt;br /&gt;
* Second, formalize the contents using a conventional logic format understandable by https://logictools.org/ . You cannot realistically formalize everything in a room: do it to a reasonable, yet interesting level / number of objects described.&lt;br /&gt;
&lt;br /&gt;
* Third, convert the contents to [https://json-ld.org/ json-ld]: the point here is to get some experience with json-ld, not that you really need it for the following steps here (although you can use it with the https://github.com/tammet/json-ld-logic extension).&lt;br /&gt;
&lt;br /&gt;
* Fourth, invent and add sensible common-sense rules about the physical objects in the room.&lt;br /&gt;
&lt;br /&gt;
* Fifth, demonstrate how https://logictools.org/ is able to answer (or not) various questions about the room. Both successes and failures are interesting.&lt;br /&gt;
&lt;br /&gt;
Observe that logictools is able to understand a specific json format, which includes a subset of json-ld. See https://logictools.org/json.html , the &amp;quot;examples&amp;quot; selection box and the spec https://github.com/tammet/json-ld-logic for that. Under &amp;quot;Advanced&amp;quot; button you can convert between two representations. NB! This conversion does not convert conventional logic to json-ld. Also, using json-ld directly as a first format for representation might be cumbersone, and logictool has different quirks and limitations handling json-ld directly. In other words, while it makes sense to experiment with logictools with json-ld, use this combo for experimentation, and maybe not as a primary representation format, unless you are brave :)&lt;br /&gt;
&lt;br /&gt;
== Presentation ==&lt;br /&gt;
&lt;br /&gt;
The results of the lab should be shown to Riina during lab time, so she can ask questions and discuss the results and the process.&lt;br /&gt;
&lt;br /&gt;
== LLM policy ==&lt;br /&gt;
&lt;br /&gt;
It is OK to use an LLM, but do &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;not yet show&amp;lt;/font&amp;gt; your room image to an LLM: we will experiment with LLM image handling in later practice tasks.&lt;br /&gt;
&lt;br /&gt;
Also, please add a short information about your llm use to the overview of the results: which LLMs you used, for what and what was the experience.&lt;br /&gt;
&lt;br /&gt;
== Ideas and inspiration ==&lt;br /&gt;
&lt;br /&gt;
For inspiration you may want to have a look at the following relatively complex suggestions of encoding information about rooms and things. Please do not try to use these exactly, just read them for ideas:&lt;br /&gt;
&lt;br /&gt;
* https://docs.brickschema.org/modeling/collections.html&lt;br /&gt;
* https://w3c-lbd-cg.github.io/bot/&lt;br /&gt;
* https://www.w3.org/WoT/&lt;br /&gt;
* https://www.w3.org/TR/2025/WD-wot-thing-description-2.0-20251104/#td-basic-types-mapping&lt;br /&gt;
&lt;br /&gt;
Space and time, fairly complex ideas:&lt;br /&gt;
&lt;br /&gt;
* https://www.irit.fr/publis/LILAC/V-SRR97.pdf&lt;br /&gt;
&lt;br /&gt;
== 10. veebruari harjutus ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nextTo(sofa, lamp).&lt;br /&gt;
nextTo(cabinet, desk).&lt;br /&gt;
nextTo(cabinet, plant1).&lt;br /&gt;
attachedTo(cabinet, hanger).&lt;br /&gt;
on(desk, plant2).&lt;br /&gt;
on(desk, glass).&lt;br /&gt;
on(desk, papers).&lt;br /&gt;
on(papers, phone).&lt;br /&gt;
in(glass, water).&lt;br /&gt;
nextTo(desk, window).&lt;br /&gt;
nextTo(desk, curtains).&lt;br /&gt;
nextTo(window, curtains).&lt;br /&gt;
name(plant1, &amp;quot;Ficus benjamina&amp;quot;).&lt;br /&gt;
name(plant2, &amp;quot;Spathiphyllum&amp;quot;).&lt;br /&gt;
weight(cabinet, 90).&lt;br /&gt;
&lt;br /&gt;
color(sofa, &#039;olive green&#039;).&lt;br /&gt;
color(curtains, blue).&lt;br /&gt;
color(plant1, green).&lt;br /&gt;
color(plant2, green).&lt;br /&gt;
&lt;br /&gt;
plant(plant1).&lt;br /&gt;
plant(plant2).&lt;br /&gt;
&lt;br /&gt;
%rules&lt;br /&gt;
on(X,Y) &amp;amp; in(Y,Z) =&amp;gt; on(X,Z).&lt;br /&gt;
on(X,Y) =&amp;gt; below(Y,X).&lt;br /&gt;
on(X,Y) &amp;amp; on(Y,Z) =&amp;gt; on(X,Z).&lt;br /&gt;
&lt;br /&gt;
%questions&lt;br /&gt;
%color(sofa, Color) =&amp;gt; $ans(Color).&lt;br /&gt;
furniture(X) &amp;amp; weight(X, Kaal) &amp;amp; $greatereq(Kaal, 50) =&amp;gt; $ans(X, Kaal).&lt;br /&gt;
%plant(X) &amp;amp; name(X, Name1) &amp;amp; plant(Y) &amp;amp; name(Y, Name2) &amp;amp; Name1!=Name2 =&amp;gt; $ans(X, Name1,Y, Name2).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22692</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22692"/>
		<updated>2026-02-03T10:15:48Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Third lab: questions in NLP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2025|2025]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! Materjalid hetkel uuendamisel&amp;lt;/font&amp;gt; =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Mondays 12:00-13:30 room SOC 414&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Tuesdays 08:00-09:30 room MEK-122; in week five, the session will be held in room MEK-109.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3A-xXLRsURTirXcCCkQN46w4wYRJaarxbl797KeThtWXY1%40thread.tacv2/conversations?groupId=30b97413-f1b1-404d-8498-b35024d1a002&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams group] of the course. The code for joining is zb3z457.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/33688408323196?p=sd6YBPK9VZ7gRe7Zro teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/3558703223396?p=zc4Lgecwoy1e9Yhav9 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam (10 of these on the page), while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials (20 on the page) will also come up, but less and/or in a simpler form. &lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; The plan for practice work is currently being updated. The information below is not up to date yet, except for the first lab, which is already updated for 2026.&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2026 homework part 1|2026 task for the first lab]] is about encoding nontrivial information in various ways (standard logic, rdf, json-ld) and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Deadline: 10. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
&lt;br /&gt;
See [[Details of the KR second lab in 2025]]. There are 5 options, you only have to choose one.&lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change. &lt;br /&gt;
&lt;br /&gt;
Deadline: 7. April? (may change)&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
&amp;lt;!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Deadline: 12. May&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- We will do live experimenting for the third lab at the April 22 lecture and will then add more interesting parts to the notes above. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NB! The task description above has just been updated (at 23. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin. &amp;lt;!-- [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) --&amp;gt; [https://web.stanford.edu/~jurafsky/slp3/ the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read [https://web.stanford.edu/~jurafsky/slp3/20.pdf chapter 6 about extracting information] and the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/H.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture] --&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2025 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 2. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2026.pdf|teadmised_intro2026.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel], [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel],&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 9. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl: 16. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: 23. February ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: looking into main large knowledge bases  ===&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors]. &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM) ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_intro.pdf|Lecture material]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning + open/closed world, planning, frame problem, blocks world. 1 April ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;First, some results/challenges in neurosymbolic reasoning.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]&lt;br /&gt;
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]&lt;br /&gt;
* [https://arcprize.org/ arcprize]. See also [https://liusida.github.io/ARC/ ARC v1 for humans], [https://www.youtube.com/watch?v=jSAT_RuJ_Cg MLST about the state of v1 solvers], [https://www.youtube.com/watch?v=M3b59lZYBW8 MLST video introducing ARC v2]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Second, planning, open/closed worlds and the frame problem. &amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Reasoning with uncertainty and intro to lab 3 ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links. In particular, [https://en.wikipedia.org/wiki/Bayesian_inference Wiki on Bayesian inference] and [https://math.mit.edu/~dav/05.dir/class11-prep.pdf this]&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: visual reasoning  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher Mohit Vaishnav. You may want to have a look at his [https://vaishnavmohit.github.io/phd_thesis/ thesis] from 2023.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: third lab live experiments ===&lt;br /&gt;
&lt;br /&gt;
We will do live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
Previous plan was: continue with uncertainty, numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing  ===&lt;br /&gt;
&lt;br /&gt;
The focus of the lecture is on [https://en.wikipedia.org/wiki/Semantic_parsing semantic parsing].&lt;br /&gt;
&lt;br /&gt;
Here are Martin&#039;s slides from 2024 [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
We will look at both (a) classic paradigms of semantic parsing (as on the slides), (b) using LLMs and alternative modern paradigms for semantic parsing.&lt;br /&gt;
&lt;br /&gt;
About important concepts in parsing:&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Part_of_speech Part-Of-Speech (POS)] and [https://en.wikipedia.org/wiki/Part-of-speech_tagging POS tagging]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/18.pdf Jurafsky&amp;amp;Martin: Constituency Parsing]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/19.pdf Jurafsky&amp;amp;Martin: Dependency Parsing]&lt;br /&gt;
&lt;br /&gt;
Some important toolkits and representation schemes:&lt;br /&gt;
* [https://spacy.io spacy], [[a small spacy UD parsing example]]&lt;br /&gt;
* [https://stanfordnlp.github.io/stanza/ stanza]&lt;br /&gt;
* [https://universaldependencies.org/ universal dependencies]&lt;br /&gt;
&lt;br /&gt;
Some draft parsing papers:&lt;br /&gt;
* [[Media:concepts_draft_paper.pdf|concepts, based on UD]]&lt;br /&gt;
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]&lt;br /&gt;
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]&lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued  ===&lt;br /&gt;
&lt;br /&gt;
Lecture will be given by Martin Verrev on teams only (not the lecture room).&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning and consultation for the exam  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22691</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22691"/>
		<updated>2026-02-03T10:15:19Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Second lab */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2025|2025]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! Materjalid hetkel uuendamisel&amp;lt;/font&amp;gt; =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Mondays 12:00-13:30 room SOC 414&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Tuesdays 08:00-09:30 room MEK-122; in week five, the session will be held in room MEK-109.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3A-xXLRsURTirXcCCkQN46w4wYRJaarxbl797KeThtWXY1%40thread.tacv2/conversations?groupId=30b97413-f1b1-404d-8498-b35024d1a002&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams group] of the course. The code for joining is zb3z457.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/33688408323196?p=sd6YBPK9VZ7gRe7Zro teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/3558703223396?p=zc4Lgecwoy1e9Yhav9 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam (10 of these on the page), while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials (20 on the page) will also come up, but less and/or in a simpler form. &lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; The plan for practice work is currently being updated. The information below is not up to date yet, except for the first lab, which is already updated for 2026.&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2026 homework part 1|2026 task for the first lab]] is about encoding nontrivial information in various ways (standard logic, rdf, json-ld) and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Deadline: 10. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
&lt;br /&gt;
See [[Details of the KR second lab in 2025]]. There are 5 options, you only have to choose one.&lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change. &lt;br /&gt;
&lt;br /&gt;
Deadline: 7. April? (may change)&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
&amp;lt;!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Deadline: 14. May (recommended). However, it is possible to present your work in other practice sessions before or after the 14. May (including 21. May).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- We will do live experimenting for the third lab at the April 22 lecture and will then add more interesting parts to the notes above. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NB! The task description above has just been updated (at 23. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin. &amp;lt;!-- [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) --&amp;gt; [https://web.stanford.edu/~jurafsky/slp3/ the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read [https://web.stanford.edu/~jurafsky/slp3/20.pdf chapter 6 about extracting information] and the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/H.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture] --&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2025 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 2. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2026.pdf|teadmised_intro2026.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel], [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel],&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 9. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl: 16. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: 23. February ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: looking into main large knowledge bases  ===&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors]. &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM) ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_intro.pdf|Lecture material]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning + open/closed world, planning, frame problem, blocks world. 1 April ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;First, some results/challenges in neurosymbolic reasoning.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]&lt;br /&gt;
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]&lt;br /&gt;
* [https://arcprize.org/ arcprize]. See also [https://liusida.github.io/ARC/ ARC v1 for humans], [https://www.youtube.com/watch?v=jSAT_RuJ_Cg MLST about the state of v1 solvers], [https://www.youtube.com/watch?v=M3b59lZYBW8 MLST video introducing ARC v2]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Second, planning, open/closed worlds and the frame problem. &amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Reasoning with uncertainty and intro to lab 3 ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links. In particular, [https://en.wikipedia.org/wiki/Bayesian_inference Wiki on Bayesian inference] and [https://math.mit.edu/~dav/05.dir/class11-prep.pdf this]&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: visual reasoning  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher Mohit Vaishnav. You may want to have a look at his [https://vaishnavmohit.github.io/phd_thesis/ thesis] from 2023.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: third lab live experiments ===&lt;br /&gt;
&lt;br /&gt;
We will do live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
Previous plan was: continue with uncertainty, numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing  ===&lt;br /&gt;
&lt;br /&gt;
The focus of the lecture is on [https://en.wikipedia.org/wiki/Semantic_parsing semantic parsing].&lt;br /&gt;
&lt;br /&gt;
Here are Martin&#039;s slides from 2024 [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
We will look at both (a) classic paradigms of semantic parsing (as on the slides), (b) using LLMs and alternative modern paradigms for semantic parsing.&lt;br /&gt;
&lt;br /&gt;
About important concepts in parsing:&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Part_of_speech Part-Of-Speech (POS)] and [https://en.wikipedia.org/wiki/Part-of-speech_tagging POS tagging]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/18.pdf Jurafsky&amp;amp;Martin: Constituency Parsing]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/19.pdf Jurafsky&amp;amp;Martin: Dependency Parsing]&lt;br /&gt;
&lt;br /&gt;
Some important toolkits and representation schemes:&lt;br /&gt;
* [https://spacy.io spacy], [[a small spacy UD parsing example]]&lt;br /&gt;
* [https://stanfordnlp.github.io/stanza/ stanza]&lt;br /&gt;
* [https://universaldependencies.org/ universal dependencies]&lt;br /&gt;
&lt;br /&gt;
Some draft parsing papers:&lt;br /&gt;
* [[Media:concepts_draft_paper.pdf|concepts, based on UD]]&lt;br /&gt;
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]&lt;br /&gt;
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]&lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued  ===&lt;br /&gt;
&lt;br /&gt;
Lecture will be given by Martin Verrev on teams only (not the lecture room).&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning and consultation for the exam  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22690</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22690"/>
		<updated>2026-02-03T09:08:40Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Time, place, result */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2025|2025]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! Materjalid hetkel uuendamisel&amp;lt;/font&amp;gt; =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Mondays 12:00-13:30 room SOC 414&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Tuesdays 08:00-09:30 room MEK-122; in week five, the session will be held in room MEK-109.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3A-xXLRsURTirXcCCkQN46w4wYRJaarxbl797KeThtWXY1%40thread.tacv2/conversations?groupId=30b97413-f1b1-404d-8498-b35024d1a002&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams group] of the course. The code for joining is zb3z457.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/33688408323196?p=sd6YBPK9VZ7gRe7Zro teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/3558703223396?p=zc4Lgecwoy1e9Yhav9 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam (10 of these on the page), while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials (20 on the page) will also come up, but less and/or in a simpler form. &lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; The plan for practice work is currently being updated. The information below is not up to date yet, except for the first lab, which is already updated for 2026.&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2026 homework part 1|2026 task for the first lab]] is about encoding nontrivial information in various ways (standard logic, rdf, json-ld) and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Deadline: 10. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
&lt;br /&gt;
See [[Details of the KR second lab in 2025]]. There are 5 options, you only have to choose one.&lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change. &lt;br /&gt;
&lt;br /&gt;
Deadline: &amp;lt;s&amp;gt;9. April&amp;lt;/s&amp;gt; 16. April&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
&amp;lt;!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Deadline: 14. May (recommended). However, it is possible to present your work in other practice sessions before or after the 14. May (including 21. May).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- We will do live experimenting for the third lab at the April 22 lecture and will then add more interesting parts to the notes above. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NB! The task description above has just been updated (at 23. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin. &amp;lt;!-- [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) --&amp;gt; [https://web.stanford.edu/~jurafsky/slp3/ the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read [https://web.stanford.edu/~jurafsky/slp3/20.pdf chapter 6 about extracting information] and the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/H.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture] --&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2025 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 2. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2026.pdf|teadmised_intro2026.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel], [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel],&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 9. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl: 16. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: 23. February ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: looking into main large knowledge bases  ===&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors]. &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM) ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_intro.pdf|Lecture material]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning + open/closed world, planning, frame problem, blocks world. 1 April ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;First, some results/challenges in neurosymbolic reasoning.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]&lt;br /&gt;
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]&lt;br /&gt;
* [https://arcprize.org/ arcprize]. See also [https://liusida.github.io/ARC/ ARC v1 for humans], [https://www.youtube.com/watch?v=jSAT_RuJ_Cg MLST about the state of v1 solvers], [https://www.youtube.com/watch?v=M3b59lZYBW8 MLST video introducing ARC v2]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Second, planning, open/closed worlds and the frame problem. &amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Reasoning with uncertainty and intro to lab 3 ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links. In particular, [https://en.wikipedia.org/wiki/Bayesian_inference Wiki on Bayesian inference] and [https://math.mit.edu/~dav/05.dir/class11-prep.pdf this]&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: visual reasoning  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher Mohit Vaishnav. You may want to have a look at his [https://vaishnavmohit.github.io/phd_thesis/ thesis] from 2023.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: third lab live experiments ===&lt;br /&gt;
&lt;br /&gt;
We will do live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
Previous plan was: continue with uncertainty, numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing  ===&lt;br /&gt;
&lt;br /&gt;
The focus of the lecture is on [https://en.wikipedia.org/wiki/Semantic_parsing semantic parsing].&lt;br /&gt;
&lt;br /&gt;
Here are Martin&#039;s slides from 2024 [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
We will look at both (a) classic paradigms of semantic parsing (as on the slides), (b) using LLMs and alternative modern paradigms for semantic parsing.&lt;br /&gt;
&lt;br /&gt;
About important concepts in parsing:&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Part_of_speech Part-Of-Speech (POS)] and [https://en.wikipedia.org/wiki/Part-of-speech_tagging POS tagging]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/18.pdf Jurafsky&amp;amp;Martin: Constituency Parsing]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/19.pdf Jurafsky&amp;amp;Martin: Dependency Parsing]&lt;br /&gt;
&lt;br /&gt;
Some important toolkits and representation schemes:&lt;br /&gt;
* [https://spacy.io spacy], [[a small spacy UD parsing example]]&lt;br /&gt;
* [https://stanfordnlp.github.io/stanza/ stanza]&lt;br /&gt;
* [https://universaldependencies.org/ universal dependencies]&lt;br /&gt;
&lt;br /&gt;
Some draft parsing papers:&lt;br /&gt;
* [[Media:concepts_draft_paper.pdf|concepts, based on UD]]&lt;br /&gt;
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]&lt;br /&gt;
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]&lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued  ===&lt;br /&gt;
&lt;br /&gt;
Lecture will be given by Martin Verrev on teams only (not the lecture room).&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning and consultation for the exam  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22689</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22689"/>
		<updated>2026-02-03T08:20:03Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* First lab */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2025|2025]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB! Materjalid hetkel uuendamisel&amp;lt;/font&amp;gt; =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Mondays 12:00-13:30 room SOC 414&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Tuesdays 08:00-09:30 room MEK-122.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3A-xXLRsURTirXcCCkQN46w4wYRJaarxbl797KeThtWXY1%40thread.tacv2/conversations?groupId=30b97413-f1b1-404d-8498-b35024d1a002&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams group] of the course. The code for joining is zb3z457.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/33688408323196?p=sd6YBPK9VZ7gRe7Zro teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/meet/3558703223396?p=zc4Lgecwoy1e9Yhav9 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam (10 of these on the page), while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials (20 on the page) will also come up, but less and/or in a simpler form. &lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; The plan for practice work is currently being updated. The information below is not up to date yet, except for the first lab, which is already updated for 2026.&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2026 homework part 1|2026 task for the first lab]] is about encoding nontrivial information in various ways (standard logic, rdf, json-ld) and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Deadline: 10. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
&lt;br /&gt;
See [[Details of the KR second lab in 2025]]. There are 5 options, you only have to choose one.&lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change. &lt;br /&gt;
&lt;br /&gt;
Deadline: &amp;lt;s&amp;gt;9. April&amp;lt;/s&amp;gt; 16. April&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
This is an example from 2025, not the task for 2026:&lt;br /&gt;
&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
&amp;lt;!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Deadline: 14. May (recommended). However, it is possible to present your work in other practice sessions before or after the 14. May (including 21. May).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- We will do live experimenting for the third lab at the April 22 lecture and will then add more interesting parts to the notes above. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NB! The task description above has just been updated (at 23. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin. &amp;lt;!-- [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) --&amp;gt; [https://web.stanford.edu/~jurafsky/slp3/ the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read [https://web.stanford.edu/~jurafsky/slp3/20.pdf chapter 6 about extracting information] and the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/H.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture] --&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2025 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 2. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2026.pdf|teadmised_intro2026.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel], [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel],&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 9. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl: 16. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: 23. February ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: looking into main large knowledge bases  ===&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors]. &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM) ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_intro.pdf|Lecture material]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning + open/closed world, planning, frame problem, blocks world. 1 April ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;First, some results/challenges in neurosymbolic reasoning.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]&lt;br /&gt;
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]&lt;br /&gt;
* [https://arcprize.org/ arcprize]. See also [https://liusida.github.io/ARC/ ARC v1 for humans], [https://www.youtube.com/watch?v=jSAT_RuJ_Cg MLST about the state of v1 solvers], [https://www.youtube.com/watch?v=M3b59lZYBW8 MLST video introducing ARC v2]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Second, planning, open/closed worlds and the frame problem. &amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Reasoning with uncertainty and intro to lab 3 ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links. In particular, [https://en.wikipedia.org/wiki/Bayesian_inference Wiki on Bayesian inference] and [https://math.mit.edu/~dav/05.dir/class11-prep.pdf this]&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: visual reasoning  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher Mohit Vaishnav. You may want to have a look at his [https://vaishnavmohit.github.io/phd_thesis/ thesis] from 2023.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: third lab live experiments ===&lt;br /&gt;
&lt;br /&gt;
We will do live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
Previous plan was: continue with uncertainty, numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing  ===&lt;br /&gt;
&lt;br /&gt;
The focus of the lecture is on [https://en.wikipedia.org/wiki/Semantic_parsing semantic parsing].&lt;br /&gt;
&lt;br /&gt;
Here are Martin&#039;s slides from 2024 [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
We will look at both (a) classic paradigms of semantic parsing (as on the slides), (b) using LLMs and alternative modern paradigms for semantic parsing.&lt;br /&gt;
&lt;br /&gt;
About important concepts in parsing:&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Part_of_speech Part-Of-Speech (POS)] and [https://en.wikipedia.org/wiki/Part-of-speech_tagging POS tagging]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/18.pdf Jurafsky&amp;amp;Martin: Constituency Parsing]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/19.pdf Jurafsky&amp;amp;Martin: Dependency Parsing]&lt;br /&gt;
&lt;br /&gt;
Some important toolkits and representation schemes:&lt;br /&gt;
* [https://spacy.io spacy], [[a small spacy UD parsing example]]&lt;br /&gt;
* [https://stanfordnlp.github.io/stanza/ stanza]&lt;br /&gt;
* [https://universaldependencies.org/ universal dependencies]&lt;br /&gt;
&lt;br /&gt;
Some draft parsing papers:&lt;br /&gt;
* [[Media:concepts_draft_paper.pdf|concepts, based on UD]]&lt;br /&gt;
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]&lt;br /&gt;
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]&lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued  ===&lt;br /&gt;
&lt;br /&gt;
Lecture will be given by Martin Verrev on teams only (not the lecture room).&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning and consultation for the exam  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22188</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22188"/>
		<updated>2025-05-05T12:22:11Z</updated>

		<summary type="html">&lt;p&gt;Riina: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2024|2024]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; about 29. April =&lt;br /&gt;
&lt;br /&gt;
The 29. April lecture will be on teams, not in the lecture room.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Tuesdays 14:00-15:30 room SOC 312/313 (313 weeks 1,3,5,...; 312 weeks 2,4,6,...)&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Wednesdays 12:00-13:30 room U06A-204.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3AmRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81%40thread.tacv2/conversations?groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams] of the course. The code for joining is &lt;br /&gt;
y0bd8e5.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566436916?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566436916&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566436916 teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566518846?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566518846&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566518846 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam, while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials will also come up, but less and/or in a simpler form. The markings will be changed as the course progresses, i.e. the future ones will not necessarily persist!&lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2025 homework part 1|2025 task for the first lab]] is about handling and understanding triplet stores, meaning of rdf types/properties/etc and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change.&lt;br /&gt;
&lt;br /&gt;
Deadline: 5. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
See [[Details of the KR second lab in 2025]]. There are 5 options, you only have to choose one.&lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change. &lt;br /&gt;
&lt;br /&gt;
Deadline: &amp;lt;s&amp;gt;9. April&amp;lt;/s&amp;gt; 16. April&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
This is updated!&lt;br /&gt;
&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
&amp;lt;!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Deadline: 14. May (recommended). However, it is possible to present your work in other practice sessions before or after the 14. May (including 21. May).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- We will do live experimenting for the third lab at the April 22 lecture and will then add more interesting parts to the notes above. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NB! The task description above has just been updated (at 23. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin.  [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) [https://web.stanford.edu/~jurafsky/slp3/ here the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/F.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
* [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2024 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 4. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2025.pdf|teadmised_intro2025.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel], [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel],&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 11. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl: 18. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: 25. February ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: looking into main large knowledge bases: 4. March  ===&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors: 11 March ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors].&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM): 18 March ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_intro.pdf|Lecture material]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG: 25 March ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning + open/closed world, planning, frame problem, blocks world. 1 April ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;First, some results/challenges in neurosymbolic reasoning.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]&lt;br /&gt;
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]&lt;br /&gt;
* [https://arcprize.org/ arcprize]. See also [https://liusida.github.io/ARC/ ARC v1 for humans], [https://www.youtube.com/watch?v=jSAT_RuJ_Cg MLST about the state of v1 solvers], [https://www.youtube.com/watch?v=M3b59lZYBW8 MLST video introducing ARC v2]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Second, planning, open/closed worlds and the frame problem. &amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Reasoning with uncertainty and intro to lab 3: 8 April ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links. In particular, [https://en.wikipedia.org/wiki/Bayesian_inference Wiki on Bayesian inference] and [https://math.mit.edu/~dav/05.dir/class11-prep.pdf this]&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: visual reasoning: 15 April  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher Mohit Vaishnav. You may want to have a look at his [https://vaishnavmohit.github.io/phd_thesis/ thesis] from 2023.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: third lab live experiments: 22 April ===&lt;br /&gt;
&lt;br /&gt;
We will do live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
Previous plan was: continue with uncertainty, numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing: 29 April  ===&lt;br /&gt;
&lt;br /&gt;
The focus of the lecture is on [https://en.wikipedia.org/wiki/Semantic_parsing semantic parsing].&lt;br /&gt;
&lt;br /&gt;
Here are Martin&#039;s slides from 2024 [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
We will look at both (a) classic paradigms of semantic parsing (as on the slides), (b) using LLMs and alternative modern paradigms for semantic parsing.&lt;br /&gt;
&lt;br /&gt;
About important concepts in parsing:&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Part_of_speech Part-Of-Speech (POS)] and [https://en.wikipedia.org/wiki/Part-of-speech_tagging POS tagging]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/18.pdf Jurafsky&amp;amp;Martin: Constituency Parsing]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/19.pdf Jurafsky&amp;amp;Martin: Dependency Parsing]&lt;br /&gt;
&lt;br /&gt;
Some important toolkits and representation schemes:&lt;br /&gt;
* [https://spacy.io spacy], [[a small spacy UD parsing example]]&lt;br /&gt;
* [https://stanfordnlp.github.io/stanza/ stanza]&lt;br /&gt;
* [https://universaldependencies.org/ universal dependencies]&lt;br /&gt;
&lt;br /&gt;
Some draft parsing papers:&lt;br /&gt;
* [[Media:concepts_draft_paper.pdf|concepts, based on UD]]&lt;br /&gt;
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]&lt;br /&gt;
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]&lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued: 6 May  ===&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning: 13 May  ===&lt;br /&gt;
&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning ja konsultatsioon eksamiks ===&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22163</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22163"/>
		<updated>2025-04-28T10:49:04Z</updated>

		<summary type="html">&lt;p&gt;Riina: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2024|2024]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; about 29. April =&lt;br /&gt;
&lt;br /&gt;
The 29. April lecture will be on teams, not in the lecture room.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; about 30. April =&lt;br /&gt;
&lt;br /&gt;
The 30. April practice session will be on Teams only, not in the lecture room.&lt;br /&gt;
&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Tuesdays 14:00-15:30 room SOC 312/313 (313 weeks 1,3,5,...; 312 weeks 2,4,6,...)&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Wednesdays 12:00-13:30 room U06A-204.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3AmRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81%40thread.tacv2/conversations?groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams] of the course. The code for joining is &lt;br /&gt;
y0bd8e5.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566436916?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566436916&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566436916 teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566518846?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566518846&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566518846 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam, while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials will also come up, but less and/or in a simpler form. The markings will be changed as the course progresses, i.e. the future ones will not necessarily persist!&lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2025 homework part 1|2025 task for the first lab]] is about handling and understanding triplet stores, meaning of rdf types/properties/etc and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change.&lt;br /&gt;
&lt;br /&gt;
Deadline: 5. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
See [[Details of the KR second lab in 2025]]. There are 5 options, you only have to choose one.&lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change. &lt;br /&gt;
&lt;br /&gt;
Deadline: &amp;lt;s&amp;gt;9. April&amp;lt;/s&amp;gt; 16. April&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
This is updated!&lt;br /&gt;
&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
&amp;lt;!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Deadline: 14. May (recommended). However, it is possible to present your work in other practice sessions before or after the 14. May (including 21. May).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- We will do live experimenting for the third lab at the April 22 lecture and will then add more interesting parts to the notes above. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NB! The task description above has just been updated (at 23. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin.  [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) [https://web.stanford.edu/~jurafsky/slp3/ here the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/F.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
* [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2024 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 4. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2025.pdf|teadmised_intro2025.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel], [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel],&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 11. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl: 18. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: 25. February ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: looking into main large knowledge bases: 4. March  ===&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors: 11 March ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors].&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM): 18 March ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_intro.pdf|Lecture material]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG: 25 March ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning + open/closed world, planning, frame problem, blocks world. 1 April ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;First, some results/challenges in neurosymbolic reasoning.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]&lt;br /&gt;
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]&lt;br /&gt;
* [https://arcprize.org/ arcprize]. See also [https://liusida.github.io/ARC/ ARC v1 for humans], [https://www.youtube.com/watch?v=jSAT_RuJ_Cg MLST about the state of v1 solvers], [https://www.youtube.com/watch?v=M3b59lZYBW8 MLST video introducing ARC v2]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Second, planning, open/closed worlds and the frame problem. &amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Reasoning with uncertainty and intro to lab 3: 8 April ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links. In particular, [https://en.wikipedia.org/wiki/Bayesian_inference Wiki on Bayesian inference] and [https://math.mit.edu/~dav/05.dir/class11-prep.pdf this]&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: visual reasoning: 15 April  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher Mohit Vaishnav. You may want to have a look at his [https://vaishnavmohit.github.io/phd_thesis/ thesis] from 2023.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: third lab live experiments: 22 April ===&lt;br /&gt;
&lt;br /&gt;
We will do live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
Previous plan was: continue with uncertainty, numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing: 29 April  ===&lt;br /&gt;
&lt;br /&gt;
The focus of the lecture is on [https://en.wikipedia.org/wiki/Semantic_parsing semantic parsing].&lt;br /&gt;
&lt;br /&gt;
Here are Martin&#039;s slides from 2024 [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
We will look at both (a) classic paradigms of semantic parsing (as on the slides), (b) using LLMs and alternative modern paradigms for semantic parsing.&lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued: 6 May  ===&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning: 13 May  ===&lt;br /&gt;
&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning ja konsultatsioon eksamiks ===&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22157</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22157"/>
		<updated>2025-04-24T07:45:35Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Third lab: questions in NLP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2024|2024]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; about 22. April =&lt;br /&gt;
&lt;br /&gt;
We will start with live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
NB! The third lab task description has just been updated (at 23. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Tuesdays 14:00-15:30 room SOC 312/313 (313 weeks 1,3,5,...; 312 weeks 2,4,6,...)&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Wednesdays 12:00-13:30 room U06A-204.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3AmRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81%40thread.tacv2/conversations?groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams] of the course. The code for joining is &lt;br /&gt;
y0bd8e5.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566436916?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566436916&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566436916 teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566518846?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566518846&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566518846 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam, while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials will also come up, but less and/or in a simpler form. The markings will be changed as the course progresses, i.e. the future ones will not necessarily persist!&lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2025 homework part 1|2025 task for the first lab]] is about handling and understanding triplet stores, meaning of rdf types/properties/etc and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change.&lt;br /&gt;
&lt;br /&gt;
Deadline: 5. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
See [[Details of the KR second lab in 2025]]. There are 5 options, you only have to choose one.&lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change. &lt;br /&gt;
&lt;br /&gt;
Deadline: &amp;lt;s&amp;gt;9. April&amp;lt;/s&amp;gt; 16. April&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
This is updated!&lt;br /&gt;
&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
&amp;lt;!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Deadline: 14. May (recommended). However, it is possible to present your work in other practice sessions before or after the 14. May (including 21. May).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- We will do live experimenting for the third lab at the April 22 lecture and will then add more interesting parts to the notes above. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NB! The task description above has just been updated (at 23. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin.  [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) [https://web.stanford.edu/~jurafsky/slp3/ here the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/F.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
* [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2024 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 4. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2025.pdf|teadmised_intro2025.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel], [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel],&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 11. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl: 18. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: 25. February ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: looking into main large knowledge bases: 4. March  ===&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors: 11 March ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors].&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM): 18 March ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_intro.pdf|Lecture material]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG: 25 March ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning + open/closed world, planning, frame problem, blocks world. 1 April ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;First, some results/challenges in neurosymbolic reasoning.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]&lt;br /&gt;
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]&lt;br /&gt;
* [https://arcprize.org/ arcprize]. See also [https://liusida.github.io/ARC/ ARC v1 for humans], [https://www.youtube.com/watch?v=jSAT_RuJ_Cg MLST about the state of v1 solvers], [https://www.youtube.com/watch?v=M3b59lZYBW8 MLST video introducing ARC v2]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Second, planning, open/closed worlds and the frame problem. &amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Reasoning with uncertainty and intro to lab 3: 8 April ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links. In particular, [https://en.wikipedia.org/wiki/Bayesian_inference Wiki on Bayesian inference] and [https://math.mit.edu/~dav/05.dir/class11-prep.pdf this]&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: visual reasoning: 15 April  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher Mohit Vaishnav. You may want to have a look at his [https://vaishnavmohit.github.io/phd_thesis/ thesis] from 2023.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: third lab live experiments: 22 April ===&lt;br /&gt;
&lt;br /&gt;
We will do live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
Previous plan was: continue with uncertainty, numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing: 29 April  ===&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid: [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued: 6 May  ===&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning: 13 May  ===&lt;br /&gt;
&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning ja konsultatsioon eksamiks ===&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22156</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22156"/>
		<updated>2025-04-24T07:43:48Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Third lab: questions in NLP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2024|2024]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; about 22. April =&lt;br /&gt;
&lt;br /&gt;
We will start with live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
NB! The third lab task description has just been updated (at 23. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Tuesdays 14:00-15:30 room SOC 312/313 (313 weeks 1,3,5,...; 312 weeks 2,4,6,...)&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Wednesdays 12:00-13:30 room U06A-204.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3AmRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81%40thread.tacv2/conversations?groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams] of the course. The code for joining is &lt;br /&gt;
y0bd8e5.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566436916?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566436916&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566436916 teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566518846?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566518846&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566518846 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam, while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials will also come up, but less and/or in a simpler form. The markings will be changed as the course progresses, i.e. the future ones will not necessarily persist!&lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2025 homework part 1|2025 task for the first lab]] is about handling and understanding triplet stores, meaning of rdf types/properties/etc and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change.&lt;br /&gt;
&lt;br /&gt;
Deadline: 5. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
See [[Details of the KR second lab in 2025]]. There are 5 options, you only have to choose one.&lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change. &lt;br /&gt;
&lt;br /&gt;
Deadline: &amp;lt;s&amp;gt;9. April&amp;lt;/s&amp;gt; 16. April&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
This is updated!&lt;br /&gt;
&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
&amp;lt;!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Deadline: 14. May (recommended). However, it is possible to present your work in other practice sessions before or after (including 21. May).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- We will do live experimenting for the third lab at the April 22 lecture and will then add more interesting parts to the notes above. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NB! The task description above has just been updated (at 23. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin.  [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) [https://web.stanford.edu/~jurafsky/slp3/ here the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/F.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
* [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2024 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 4. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2025.pdf|teadmised_intro2025.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel], [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel],&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 11. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl: 18. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: 25. February ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: looking into main large knowledge bases: 4. March  ===&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors: 11 March ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors].&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM): 18 March ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_intro.pdf|Lecture material]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG: 25 March ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning + open/closed world, planning, frame problem, blocks world. 1 April ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;First, some results/challenges in neurosymbolic reasoning.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]&lt;br /&gt;
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]&lt;br /&gt;
* [https://arcprize.org/ arcprize]. See also [https://liusida.github.io/ARC/ ARC v1 for humans], [https://www.youtube.com/watch?v=jSAT_RuJ_Cg MLST about the state of v1 solvers], [https://www.youtube.com/watch?v=M3b59lZYBW8 MLST video introducing ARC v2]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Second, planning, open/closed worlds and the frame problem. &amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Reasoning with uncertainty and intro to lab 3: 8 April ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links. In particular, [https://en.wikipedia.org/wiki/Bayesian_inference Wiki on Bayesian inference] and [https://math.mit.edu/~dav/05.dir/class11-prep.pdf this]&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: visual reasoning: 15 April  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher Mohit Vaishnav. You may want to have a look at his [https://vaishnavmohit.github.io/phd_thesis/ thesis] from 2023.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: third lab live experiments: 22 April ===&lt;br /&gt;
&lt;br /&gt;
We will do live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
Previous plan was: continue with uncertainty, numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing: 29 April  ===&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid: [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued: 6 May  ===&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning: 13 May  ===&lt;br /&gt;
&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning ja konsultatsioon eksamiks ===&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22155</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22155"/>
		<updated>2025-04-24T07:31:08Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Third lab: questions in NLP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2024|2024]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; about 22. April =&lt;br /&gt;
&lt;br /&gt;
We will start with live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
NB! The third lab task description has just been updated (at 23. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Tuesdays 14:00-15:30 room SOC 312/313 (313 weeks 1,3,5,...; 312 weeks 2,4,6,...)&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Wednesdays 12:00-13:30 room U06A-204.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3AmRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81%40thread.tacv2/conversations?groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams] of the course. The code for joining is &lt;br /&gt;
y0bd8e5.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566436916?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566436916&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566436916 teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566518846?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566518846&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566518846 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam, while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials will also come up, but less and/or in a simpler form. The markings will be changed as the course progresses, i.e. the future ones will not necessarily persist!&lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2025 homework part 1|2025 task for the first lab]] is about handling and understanding triplet stores, meaning of rdf types/properties/etc and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change.&lt;br /&gt;
&lt;br /&gt;
Deadline: 5. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
See [[Details of the KR second lab in 2025]]. There are 5 options, you only have to choose one.&lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change. &lt;br /&gt;
&lt;br /&gt;
Deadline: &amp;lt;s&amp;gt;9. April&amp;lt;/s&amp;gt; 16. April&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
This is updated!&lt;br /&gt;
&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
&amp;lt;!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Deadline: 14. May (recommended). However, it is possible to present your work in other practice sessions (including 21. May).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- We will do live experimenting for the third lab at the April 22 lecture and will then add more interesting parts to the notes above. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NB! The task description above has just been updated (at 23. April) with the example code and files developed and presented during the [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2025/Shared%20Documents/General/Recordings/Knowledge%20representation%202025%20lectures-20250422_140202-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=McaLE9&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin.  [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) [https://web.stanford.edu/~jurafsky/slp3/ here the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/F.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
* [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2024 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 4. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2025.pdf|teadmised_intro2025.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel], [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel],&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 11. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl: 18. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: 25. February ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: looking into main large knowledge bases: 4. March  ===&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors: 11 March ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors].&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM): 18 March ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_intro.pdf|Lecture material]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG: 25 March ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning + open/closed world, planning, frame problem, blocks world. 1 April ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;First, some results/challenges in neurosymbolic reasoning.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]&lt;br /&gt;
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]&lt;br /&gt;
* [https://arcprize.org/ arcprize]. See also [https://liusida.github.io/ARC/ ARC v1 for humans], [https://www.youtube.com/watch?v=jSAT_RuJ_Cg MLST about the state of v1 solvers], [https://www.youtube.com/watch?v=M3b59lZYBW8 MLST video introducing ARC v2]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Second, planning, open/closed worlds and the frame problem. &amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Reasoning with uncertainty and intro to lab 3: 8 April ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links. In particular, [https://en.wikipedia.org/wiki/Bayesian_inference Wiki on Bayesian inference] and [https://math.mit.edu/~dav/05.dir/class11-prep.pdf this]&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: visual reasoning: 15 April  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher Mohit Vaishnav. You may want to have a look at his [https://vaishnavmohit.github.io/phd_thesis/ thesis] from 2023.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: third lab live experiments: 22 April ===&lt;br /&gt;
&lt;br /&gt;
We will do live experiments for the third lab.&lt;br /&gt;
&lt;br /&gt;
Previous plan was: continue with uncertainty, numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing: 29 April  ===&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid: [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued: 6 May  ===&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning: 13 May  ===&lt;br /&gt;
&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning ja konsultatsioon eksamiks ===&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22128</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22128"/>
		<updated>2025-04-09T07:23:48Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Practical work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2024|2024]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; about next week, 25. February =&lt;br /&gt;
&lt;br /&gt;
The 25. February lecture will be a recording from 2024 pluss self-study reading and experiments only, not in the lecture room: please see the 25. Feb chapter below.&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Tuesdays 14:00-15:30 room SOC 312/313 (313 weeks 1,3,5,...; 312 weeks 2,4,6,...)&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Wednesdays 12:00-13:30 room U06A-204.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3AmRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81%40thread.tacv2/conversations?groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams] of the course. The code for joining is &lt;br /&gt;
y0bd8e5.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566436916?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566436916&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566436916 teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566518846?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566518846&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566518846 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam, while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials will also come up, but less and/or in a simpler form. The markings will be changed as the course progresses, i.e. the future ones will not necessarily persist!&lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2025 homework part 1|2025 task for the first lab]] is about handling and understanding triplet stores, meaning of rdf types/properties/etc and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change.&lt;br /&gt;
&lt;br /&gt;
Deadline: 5. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
See [[Details of the KR second lab in 2025]]. There are 5 options, you only have to choose one.&lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change. &lt;br /&gt;
&lt;br /&gt;
Deadline: &amp;lt;s&amp;gt;9. April&amp;lt;/s&amp;gt; 16. April&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
This is updated!&lt;br /&gt;
&lt;br /&gt;
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
&amp;lt;!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Deadline: 14. May.&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin.  [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) [https://web.stanford.edu/~jurafsky/slp3/ here the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/F.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
* [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2024 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 4. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2025.pdf|teadmised_intro2025.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel], [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel],&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 11. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl: 18. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: 25. February ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: looking into main large knowledge bases: 4. March  ===&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors: 11 March ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors].&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM): 18 March ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_intro.pdf|Lecture material]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG: 25 March ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning + open/closed world, planning, frame problem, blocks world. 1 April ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;First, some results/challenges in neurosymbolic reasoning.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]&lt;br /&gt;
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]&lt;br /&gt;
* [https://arcprize.org/ arcprize]. See also [https://liusida.github.io/ARC/ ARC v1 for humans], [https://www.youtube.com/watch?v=jSAT_RuJ_Cg MLST about the state of v1 solvers], [https://www.youtube.com/watch?v=M3b59lZYBW8 MLST video introducing ARC v2]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Second, planning, open/closed worlds and the frame problem. &amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Reasoning with uncertainty and intro to lab 3: 8 April ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links. In particular, [https://en.wikipedia.org/wiki/Bayesian_inference Wiki on Bayesian inference] and [https://math.mit.edu/~dav/05.dir/class11-prep.pdf this]&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: visual reasoning: 15 April  ===&lt;br /&gt;
&lt;br /&gt;
The lecture will be given by our postdoc researcher Mohit Vaishnav. You may want to have a look at his [https://vaishnavmohit.github.io/phd_thesis/ thesis] from 2023.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: continue with uncertainty  ===&lt;br /&gt;
&lt;br /&gt;
Numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing  ===&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid: [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued  ===&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning ja konsultatsioon eksamiks ===&lt;br /&gt;
&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Details_of_the_KR_second_lab_in_2025&amp;diff=22108</id>
		<title>Details of the KR second lab in 2025</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Details_of_the_KR_second_lab_in_2025&amp;diff=22108"/>
		<updated>2025-04-02T08:11:20Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Berti mõne derivaadi finetunimine spetsiifilise ülesande jaoks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mitu varianti LLMi katsetamine: low level (keerulisemad) kuni high-level (lihtsamad).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= LLMi ise õpetamine (mõõdukalt keeruline, kas windowsis saab, ei tea) =&lt;br /&gt;
&lt;br /&gt;
Linuxis ja Applel mõõdukalt keeruline, Windowsis ei tea, kas saab või ei.&lt;br /&gt;
&lt;br /&gt;
Karpathy nanogpt ([https://youtu.be/kCc8FmEb1nY?si=mDmodHRuQk5XFTVY video], [https://www.youtube.com/playlist?list=PLAqhIrjkxbuWI23v9cThsA9GvCAUhRvKZ videosari], [https://github.com/karpathy/nanoGPT repo]) õpetamine mõne teise korpuse pealt kui &lt;br /&gt;
shakespeare + eksperimenteerimine tekstijätkumise kvaliteediga:&lt;br /&gt;
mis töötab, mis ei. Üks variant on wikipedia tekstiformaat &lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz wikipedia täistekst]&lt;br /&gt;
ja [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz sama lemmatiseeritult]&lt;br /&gt;
&lt;br /&gt;
Eriti hea mõte oleks, kui korpuses on küsimus-vastuspaarid&lt;br /&gt;
mingi konkreetset tüüpi ülesande jaoks, a la lihtsate&lt;br /&gt;
lausete parsimine, aritmeetikatehted, valemite süntaksikontroll,&lt;br /&gt;
väga lihtsa tekstülesande teisendamine pythoni koodiks vms.&lt;br /&gt;
Küsimus-vastuspaare progega genereerida: teed N template ja&lt;br /&gt;
genereerid nendest templatedest!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alternatiiv:&#039;&#039;&#039; Võtta baasmudeliks GPT2 ja peenhäälestada (finetuning) see nanoGPT abil oma andmete abil.&lt;br /&gt;
nanoGPT võimaldab valida baasmudel nelja erineva suurusega GPT2 mudeli hulgast. Kõige väiksem on peenhäälestatav ka ilma GPU-ta arvutil (aega läheb muidugi tunde).&lt;br /&gt;
&lt;br /&gt;
Praktikumis vaadatud Hugging Face&#039;i andmestikud:&lt;br /&gt;
* [https://huggingface.co/datasets/open-thoughts/OpenThoughts-114k OpenThoughts]&lt;br /&gt;
* [https://huggingface.co/datasets/openai/gsm8k GSM8K]&lt;br /&gt;
* [https://huggingface.co/datasets/deepmind/math_dataset math_dataset]&lt;br /&gt;
&lt;br /&gt;
= Berti mõne derivaadi finetunimine spetsiifilise ülesande jaoks =&lt;br /&gt;
&lt;br /&gt;
(keeruline, jällegi, pigem linuxis; sobivate õpetuste leidmine&lt;br /&gt;
ei pruugi olla lihtne)&lt;br /&gt;
&lt;br /&gt;
Vali sobiv Berti variant ja tekita näite-küsimusvastuspaarid&lt;br /&gt;
nagu eelmises ülesandes. &lt;br /&gt;
&lt;br /&gt;
Katseta finetunitud berti: millega ta selle ülesannete klassi&lt;br /&gt;
jaoks veel hakkama saab ja millega mitte eriti.&lt;br /&gt;
&lt;br /&gt;
BERT (Hugging Face): [https://huggingface.co/docs/transformers/en/model_doc/bert https://huggingface.co/docs/transformers/en/model_doc/bert]&lt;br /&gt;
&lt;br /&gt;
SQaAd (Hugging Face): [https://huggingface.co/datasets/rajpurkar/squad https://huggingface.co/datasets/rajpurkar/squad]&lt;br /&gt;
&lt;br /&gt;
= Väikese teadmusbaasi ise ehitamine LLMi abil =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Build a small knowledge base by asking LLM. What should the knowledge be about? &lt;br /&gt;
Think about something which would be useful to know for some planning or reasoning task, &lt;br /&gt;
like distances between cities, ways to travel from one place to another, features of cities/locations or features/properties of movies, actors, books etc.&lt;br /&gt;
The knowledge base should have some explainable point to it and a limited theme/subject area: you do not want to make it too massive.&lt;br /&gt;
&lt;br /&gt;
As a small example, here is an experimental knowledge base of [http://turing.cs.ttu.ee/~tanel.tammet/sizes_best.csv sizes of objects], built&lt;br /&gt;
by Tanel in a combined way from pre-existing knowledge and by additionally asking LLM. The llm-asking python code is [http://turing.cs.ttu.ee/~tanel.tammet/llmsize.py here] &lt;br /&gt;
and it requires a file &amp;quot;secrets.js&amp;quot; containing the GPT API key like this {&amp;quot;gpt_key&amp;quot;: &amp;quot;sk-wo...2e&amp;quot;} and an existing [http://turing.cs.ttu.ee/~tanel.tammet/sizes1.txt list of words] with their rough sizes. &lt;br /&gt;
&lt;br /&gt;
You may also want to use a large [http://turing.cs.ttu.ee/~tanel.tammet/important_words.txt word/concept list] built by Tanel in a rough order of importance / frequency of use, built by combining three sources:&lt;br /&gt;
is a word known to children, the frequency in English, the number of visits on Wikipedia. NB! This file is ca 370MB: you do not want to open it in a browser.&lt;br /&gt;
&lt;br /&gt;
See [https://arxiv.org/html/2411.04920v1 GPTKB paper] and [https://gptkb.mpi-inf.mpg.de/ GPTKB homepage] for ideas. Your knowledge base does not have to be represented as triples.&lt;br /&gt;
&lt;br /&gt;
= Multishot ülesannete katsetamine LLM-iga =&lt;br /&gt;
&lt;br /&gt;
== OpenAI GPT ==&lt;br /&gt;
https://openai.com/blog/openai-api&lt;br /&gt;
&lt;br /&gt;
ja [http://turing.cs.ttu.ee/~tanel.tammet/gptapi.tar.gz näitekood api lihtsamaks kasutamiseks]&lt;br /&gt;
&lt;br /&gt;
== Teised API võimalused ==&lt;br /&gt;
&lt;br /&gt;
Samad, mis esimeses ülesandes:&lt;br /&gt;
&lt;br /&gt;
* [https://mistral.ai/ mistral.ai] you can try API for free (150.00€/month limit), in exchange your API requests may be used to improve their services.&lt;br /&gt;
&lt;br /&gt;
* [https://together.ai together.ai] that allows you to use open source LLMs for a small fee. Two of their models are available for free: Llama-3.3-70B-Instruct-Turbo-Free and DeepSeek-R1-Distill-Llama-70B-free. They used to have 25$ credit for new users, but this might not be the case anymore.&lt;br /&gt;
&lt;br /&gt;
* [https://aistudio.google.com/ aistudio.google.com] Google AI Studio now also allows to create an API key (includes a free tier), that can be used to make request over Gemini API (see the documentation: https://ai.google.dev/gemini-api/docs) for more information.&lt;br /&gt;
&lt;br /&gt;
* [https://ollama.com/ ollama.com] makes it easy to run free models on local computer. Smaller models run even without GPU.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cheahjs/free-llm-api-resources List of additional resources that have free options]&lt;br /&gt;
&lt;br /&gt;
* [https://console.groq.com/ groqcloud] Mitmed avatud mudelid&lt;br /&gt;
&lt;br /&gt;
== Chat ==&lt;br /&gt;
&lt;br /&gt;
Lisaks ChatGPT-le on palju muid chati võimalusi, millest küll kõik ei toeta veel niinimetatud &#039;&#039;Thinking&#039;&#039; ehk &#039;&#039;Reasoning&#039;&#039; režiimi.&lt;br /&gt;
&lt;br /&gt;
* [https://chat.mistral.ai/chat Mistrali Le Chat]&lt;br /&gt;
* [https://claude.ai/ claude.ai]&lt;br /&gt;
* [https://chat.deepseek.com/ deepseek.com] &lt;br /&gt;
* [https://inference.cerebras.ai/ cerebras inference Deepseek ja Llama]&lt;br /&gt;
* [https://copilot.microsoft.com/ Microsoft copilot]]&lt;br /&gt;
* [https://grok.com/ grok.com]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mida võiks proovida ==&lt;br /&gt;
&lt;br /&gt;
* Võib katsetada Taneli näitepromptidega ja leida, millega hakkama saab ja millega mitte. Hea mõte on leida spetsiifilisem ülesanne ja proovida selle jaoks prompte (N-shot).&lt;br /&gt;
&lt;br /&gt;
* Teisenda LLMi abil loomuliku keele laused logictools-ile (või gkc-le) sobivaks sisendiks (kasuta oma esimeses ülesandes tehtud näiteid).&lt;br /&gt;
&lt;br /&gt;
= Katseta LLMi otsi/järeldamisülesande jaoks = &lt;br /&gt;
&lt;br /&gt;
Katseta nö tavalist LLMi ja LLMi &#039;&#039;Thinking&#039;&#039; ehk &#039;&#039;Reasoning&#039;&#039; režiimi (ei pea olema sama mudel).&lt;br /&gt;
&lt;br /&gt;
Proovi leida keerukuse tase, kus vähemalt tavaline LLM enamasti ebaõnnestub. Võrdle, kuidas saab sama ülesandega hakkama &#039;&#039;Reasoning&#039;&#039; režiimi.&lt;br /&gt;
&lt;br /&gt;
Kuidas teha ülesannet keerulisemaks:&lt;br /&gt;
* Rohkem võimalikke teid ja ummikuid.&lt;br /&gt;
* Kasutada tundmatuid sõnu a la blabla.&lt;br /&gt;
* Lisada ballastteksti.&lt;br /&gt;
&lt;br /&gt;
Kõige parem on katsetada APIga, aga saab ka ilma. Vaata erinevaid võimalusi eelmise ülesande kirjeldusest.&lt;br /&gt;
&lt;br /&gt;
Järgnevad näited on eelmise aasta praksist https://copilot.microsoft.com/ peal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NB!&amp;lt;/b&amp;gt; Pane tähele, et LLMi vastused ei ole stabiilsed: ta võib mingi hetk vastata õieti/valesti, ja paar tundi hiljem teistpidi!&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.  &lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z. &lt;br /&gt;
There is a road from x1 to x2. &lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to x4. &lt;br /&gt;
Is there a road from x4 to x1? &lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
adsas dppdo akka assas .&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
KKKK! Asasas!&lt;br /&gt;
There is a bloo from x1 to x2.&lt;br /&gt;
sdad 103033. 223! sdsad!&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
as sasd aasd asd asd.&lt;br /&gt;
There is a friend from x2 to x4.&lt;br /&gt;
asas asas as. sdoisad, 111.&lt;br /&gt;
Is there a road from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
There is a road from x1 to x2.&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to x4.&lt;br /&gt;
There is a road from x2 to x9.&lt;br /&gt;
There is a road from x4 to x7.&lt;br /&gt;
There is a road from x6 to x10.&lt;br /&gt;
There is a road from x10 to x11.&lt;br /&gt;
There is a road from x11 to x8.&lt;br /&gt;
Is there a road from x8 to x1?&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
There is a road from x1 to x2.&lt;br /&gt;
x1 is a bad place.&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to bath.&lt;br /&gt;
There is a road from x2 to x4.&lt;br /&gt;
x2 is a nice place.&lt;br /&gt;
There is a road from x3 to somwhere.&lt;br /&gt;
John is nowhere.&lt;br /&gt;
There is no road to hell.&lt;br /&gt;
Is there a road from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If there is a blabla from X to Y, then there is a blabla from Y to X.&lt;br /&gt;
If there is a blabla from X to Y and there is a blabla from Y to Z, then there is a blabla from X to Z.&lt;br /&gt;
There is a blabla from x1 to x2.&lt;br /&gt;
x1 is a bad place.&lt;br /&gt;
There is a blabla from x2 to x3.&lt;br /&gt;
There is a blabla from x2 to bath.&lt;br /&gt;
There is a blabla from x2 to x4.&lt;br /&gt;
x2 is a nice place.&lt;br /&gt;
There is a blabla from x3 to somwhere.&lt;br /&gt;
John is nowhere.&lt;br /&gt;
There is no blabla to hell.&lt;br /&gt;
Is there a blabla from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
------&lt;br /&gt;
&lt;br /&gt;
Works OK:&lt;br /&gt;
&lt;br /&gt;
John had three apples. Mike has two pears.&lt;br /&gt;
Pears and apples are fruits. &lt;br /&gt;
Mike gives all his fruits to John.&lt;br /&gt;
How many fruits does John have?&lt;br /&gt;
&lt;br /&gt;
Does not work ok:&lt;br /&gt;
&lt;br /&gt;
John had three apples. Mike has two pears.&lt;br /&gt;
Pears and apples are fruits. &lt;br /&gt;
Mike eats two pears.&lt;br /&gt;
Mike gives all his fruits to John.&lt;br /&gt;
John eats one apple.&lt;br /&gt;
How many fruits does John have?&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Ei ole OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a white or black spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be white. &lt;br /&gt;
In fact all three spots are white. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
&lt;br /&gt;
Kui see lisada, on OK:&lt;br /&gt;
&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be yellow. &lt;br /&gt;
In fact all three spots are yellow. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be yellow. &lt;br /&gt;
In fact all three spots are not yellow. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be small. &lt;br /&gt;
In fact all three spots are large. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John in the village repairs shoes of all people in the village &lt;br /&gt;
who do not repair their own shoes. &lt;br /&gt;
Does John repair his own shoes?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John in the village shaves beards of all people in the village &lt;br /&gt;
who do not shave their beards. &lt;br /&gt;
Does John shave his own beard?&lt;br /&gt;
&lt;br /&gt;
OK&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 100 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
OK&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 100 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to east. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 80 km to east,&lt;br /&gt;
then 120 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 80 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 1 km to east,&lt;br /&gt;
then 100 km to north, then 2 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 10 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
You are a semantic parser to first order predicate logic. &lt;br /&gt;
Give a logical representation of the sentence &amp;quot;All dogs have a tail&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
???&lt;br /&gt;
&lt;br /&gt;
You are a semantic parser to first order predicate logic.&lt;br /&gt;
Examples: &lt;br /&gt;
&amp;quot;All dogs have a tail&amp;quot; -&amp;gt; All x (dog(x) =&amp;gt; Exists y (tail(y))).&lt;br /&gt;
&amp;quot;All animals have a head&amp;quot; -&amp;gt; All x (animal(x) =&amp;gt; Exists y (head(y))).&lt;br /&gt;
&amp;quot;All bears like honey&amp;quot; -&amp;gt; All x All y (animal(x) &amp;amp; honey(y) =&amp;gt; likes(x,y)).&lt;br /&gt;
&amp;quot;All birds are able to fly&amp;quot; -&amp;gt; All x (bird(x) =&amp;gt; able_to(x,fly)).&lt;br /&gt;
Give a logical representation of the sentence &amp;quot;All mice have a tail&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Details_of_the_KR_second_lab_in_2025&amp;diff=22107</id>
		<title>Details of the KR second lab in 2025</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Details_of_the_KR_second_lab_in_2025&amp;diff=22107"/>
		<updated>2025-04-02T08:10:38Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Berti mõne derivaadi finetunimine spetsiifilise ülesande jaoks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mitu varianti LLMi katsetamine: low level (keerulisemad) kuni high-level (lihtsamad).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= LLMi ise õpetamine (mõõdukalt keeruline, kas windowsis saab, ei tea) =&lt;br /&gt;
&lt;br /&gt;
Linuxis ja Applel mõõdukalt keeruline, Windowsis ei tea, kas saab või ei.&lt;br /&gt;
&lt;br /&gt;
Karpathy nanogpt ([https://youtu.be/kCc8FmEb1nY?si=mDmodHRuQk5XFTVY video], [https://www.youtube.com/playlist?list=PLAqhIrjkxbuWI23v9cThsA9GvCAUhRvKZ videosari], [https://github.com/karpathy/nanoGPT repo]) õpetamine mõne teise korpuse pealt kui &lt;br /&gt;
shakespeare + eksperimenteerimine tekstijätkumise kvaliteediga:&lt;br /&gt;
mis töötab, mis ei. Üks variant on wikipedia tekstiformaat &lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz wikipedia täistekst]&lt;br /&gt;
ja [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz sama lemmatiseeritult]&lt;br /&gt;
&lt;br /&gt;
Eriti hea mõte oleks, kui korpuses on küsimus-vastuspaarid&lt;br /&gt;
mingi konkreetset tüüpi ülesande jaoks, a la lihtsate&lt;br /&gt;
lausete parsimine, aritmeetikatehted, valemite süntaksikontroll,&lt;br /&gt;
väga lihtsa tekstülesande teisendamine pythoni koodiks vms.&lt;br /&gt;
Küsimus-vastuspaare progega genereerida: teed N template ja&lt;br /&gt;
genereerid nendest templatedest!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alternatiiv:&#039;&#039;&#039; Võtta baasmudeliks GPT2 ja peenhäälestada (finetuning) see nanoGPT abil oma andmete abil.&lt;br /&gt;
nanoGPT võimaldab valida baasmudel nelja erineva suurusega GPT2 mudeli hulgast. Kõige väiksem on peenhäälestatav ka ilma GPU-ta arvutil (aega läheb muidugi tunde).&lt;br /&gt;
&lt;br /&gt;
Praktikumis vaadatud Hugging Face&#039;i andmestikud:&lt;br /&gt;
* [https://huggingface.co/datasets/open-thoughts/OpenThoughts-114k OpenThoughts]&lt;br /&gt;
* [https://huggingface.co/datasets/openai/gsm8k GSM8K]&lt;br /&gt;
* [https://huggingface.co/datasets/deepmind/math_dataset math_dataset]&lt;br /&gt;
&lt;br /&gt;
= Berti mõne derivaadi finetunimine spetsiifilise ülesande jaoks =&lt;br /&gt;
&lt;br /&gt;
(keeruline, jällegi, pigem linuxis; sobivate õpetuste leidmine&lt;br /&gt;
ei pruugi olla lihtne)&lt;br /&gt;
&lt;br /&gt;
Vali sobiv Berti variant ja tekita näite-küsimusvastuspaarid&lt;br /&gt;
nagu eelmises ülesandes. &lt;br /&gt;
&lt;br /&gt;
Katseta finetunitud berti: millega ta selle ülesannete klassi&lt;br /&gt;
jaoks veel hakkama saab ja millega mitte eriti.&lt;br /&gt;
&lt;br /&gt;
Hugging Face-ist: [https://huggingface.co/docs/transformers/en/model_doc/bert https://huggingface.co/docs/transformers/en/model_doc/bert]&lt;br /&gt;
&lt;br /&gt;
SQaAd: [https://huggingface.co/datasets/rajpurkar/squad https://huggingface.co/datasets/rajpurkar/squad]&lt;br /&gt;
&lt;br /&gt;
= Väikese teadmusbaasi ise ehitamine LLMi abil =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Build a small knowledge base by asking LLM. What should the knowledge be about? &lt;br /&gt;
Think about something which would be useful to know for some planning or reasoning task, &lt;br /&gt;
like distances between cities, ways to travel from one place to another, features of cities/locations or features/properties of movies, actors, books etc.&lt;br /&gt;
The knowledge base should have some explainable point to it and a limited theme/subject area: you do not want to make it too massive.&lt;br /&gt;
&lt;br /&gt;
As a small example, here is an experimental knowledge base of [http://turing.cs.ttu.ee/~tanel.tammet/sizes_best.csv sizes of objects], built&lt;br /&gt;
by Tanel in a combined way from pre-existing knowledge and by additionally asking LLM. The llm-asking python code is [http://turing.cs.ttu.ee/~tanel.tammet/llmsize.py here] &lt;br /&gt;
and it requires a file &amp;quot;secrets.js&amp;quot; containing the GPT API key like this {&amp;quot;gpt_key&amp;quot;: &amp;quot;sk-wo...2e&amp;quot;} and an existing [http://turing.cs.ttu.ee/~tanel.tammet/sizes1.txt list of words] with their rough sizes. &lt;br /&gt;
&lt;br /&gt;
You may also want to use a large [http://turing.cs.ttu.ee/~tanel.tammet/important_words.txt word/concept list] built by Tanel in a rough order of importance / frequency of use, built by combining three sources:&lt;br /&gt;
is a word known to children, the frequency in English, the number of visits on Wikipedia. NB! This file is ca 370MB: you do not want to open it in a browser.&lt;br /&gt;
&lt;br /&gt;
See [https://arxiv.org/html/2411.04920v1 GPTKB paper] and [https://gptkb.mpi-inf.mpg.de/ GPTKB homepage] for ideas. Your knowledge base does not have to be represented as triples.&lt;br /&gt;
&lt;br /&gt;
= Multishot ülesannete katsetamine LLM-iga =&lt;br /&gt;
&lt;br /&gt;
== OpenAI GPT ==&lt;br /&gt;
https://openai.com/blog/openai-api&lt;br /&gt;
&lt;br /&gt;
ja [http://turing.cs.ttu.ee/~tanel.tammet/gptapi.tar.gz näitekood api lihtsamaks kasutamiseks]&lt;br /&gt;
&lt;br /&gt;
== Teised API võimalused ==&lt;br /&gt;
&lt;br /&gt;
Samad, mis esimeses ülesandes:&lt;br /&gt;
&lt;br /&gt;
* [https://mistral.ai/ mistral.ai] you can try API for free (150.00€/month limit), in exchange your API requests may be used to improve their services.&lt;br /&gt;
&lt;br /&gt;
* [https://together.ai together.ai] that allows you to use open source LLMs for a small fee. Two of their models are available for free: Llama-3.3-70B-Instruct-Turbo-Free and DeepSeek-R1-Distill-Llama-70B-free. They used to have 25$ credit for new users, but this might not be the case anymore.&lt;br /&gt;
&lt;br /&gt;
* [https://aistudio.google.com/ aistudio.google.com] Google AI Studio now also allows to create an API key (includes a free tier), that can be used to make request over Gemini API (see the documentation: https://ai.google.dev/gemini-api/docs) for more information.&lt;br /&gt;
&lt;br /&gt;
* [https://ollama.com/ ollama.com] makes it easy to run free models on local computer. Smaller models run even without GPU.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cheahjs/free-llm-api-resources List of additional resources that have free options]&lt;br /&gt;
&lt;br /&gt;
* [https://console.groq.com/ groqcloud] Mitmed avatud mudelid&lt;br /&gt;
&lt;br /&gt;
== Chat ==&lt;br /&gt;
&lt;br /&gt;
Lisaks ChatGPT-le on palju muid chati võimalusi, millest küll kõik ei toeta veel niinimetatud &#039;&#039;Thinking&#039;&#039; ehk &#039;&#039;Reasoning&#039;&#039; režiimi.&lt;br /&gt;
&lt;br /&gt;
* [https://chat.mistral.ai/chat Mistrali Le Chat]&lt;br /&gt;
* [https://claude.ai/ claude.ai]&lt;br /&gt;
* [https://chat.deepseek.com/ deepseek.com] &lt;br /&gt;
* [https://inference.cerebras.ai/ cerebras inference Deepseek ja Llama]&lt;br /&gt;
* [https://copilot.microsoft.com/ Microsoft copilot]]&lt;br /&gt;
* [https://grok.com/ grok.com]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mida võiks proovida ==&lt;br /&gt;
&lt;br /&gt;
* Võib katsetada Taneli näitepromptidega ja leida, millega hakkama saab ja millega mitte. Hea mõte on leida spetsiifilisem ülesanne ja proovida selle jaoks prompte (N-shot).&lt;br /&gt;
&lt;br /&gt;
* Teisenda LLMi abil loomuliku keele laused logictools-ile (või gkc-le) sobivaks sisendiks (kasuta oma esimeses ülesandes tehtud näiteid).&lt;br /&gt;
&lt;br /&gt;
= Katseta LLMi otsi/järeldamisülesande jaoks = &lt;br /&gt;
&lt;br /&gt;
Katseta nö tavalist LLMi ja LLMi &#039;&#039;Thinking&#039;&#039; ehk &#039;&#039;Reasoning&#039;&#039; režiimi (ei pea olema sama mudel).&lt;br /&gt;
&lt;br /&gt;
Proovi leida keerukuse tase, kus vähemalt tavaline LLM enamasti ebaõnnestub. Võrdle, kuidas saab sama ülesandega hakkama &#039;&#039;Reasoning&#039;&#039; režiimi.&lt;br /&gt;
&lt;br /&gt;
Kuidas teha ülesannet keerulisemaks:&lt;br /&gt;
* Rohkem võimalikke teid ja ummikuid.&lt;br /&gt;
* Kasutada tundmatuid sõnu a la blabla.&lt;br /&gt;
* Lisada ballastteksti.&lt;br /&gt;
&lt;br /&gt;
Kõige parem on katsetada APIga, aga saab ka ilma. Vaata erinevaid võimalusi eelmise ülesande kirjeldusest.&lt;br /&gt;
&lt;br /&gt;
Järgnevad näited on eelmise aasta praksist https://copilot.microsoft.com/ peal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NB!&amp;lt;/b&amp;gt; Pane tähele, et LLMi vastused ei ole stabiilsed: ta võib mingi hetk vastata õieti/valesti, ja paar tundi hiljem teistpidi!&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.  &lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z. &lt;br /&gt;
There is a road from x1 to x2. &lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to x4. &lt;br /&gt;
Is there a road from x4 to x1? &lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
adsas dppdo akka assas .&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
KKKK! Asasas!&lt;br /&gt;
There is a bloo from x1 to x2.&lt;br /&gt;
sdad 103033. 223! sdsad!&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
as sasd aasd asd asd.&lt;br /&gt;
There is a friend from x2 to x4.&lt;br /&gt;
asas asas as. sdoisad, 111.&lt;br /&gt;
Is there a road from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
There is a road from x1 to x2.&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to x4.&lt;br /&gt;
There is a road from x2 to x9.&lt;br /&gt;
There is a road from x4 to x7.&lt;br /&gt;
There is a road from x6 to x10.&lt;br /&gt;
There is a road from x10 to x11.&lt;br /&gt;
There is a road from x11 to x8.&lt;br /&gt;
Is there a road from x8 to x1?&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
There is a road from x1 to x2.&lt;br /&gt;
x1 is a bad place.&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to bath.&lt;br /&gt;
There is a road from x2 to x4.&lt;br /&gt;
x2 is a nice place.&lt;br /&gt;
There is a road from x3 to somwhere.&lt;br /&gt;
John is nowhere.&lt;br /&gt;
There is no road to hell.&lt;br /&gt;
Is there a road from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If there is a blabla from X to Y, then there is a blabla from Y to X.&lt;br /&gt;
If there is a blabla from X to Y and there is a blabla from Y to Z, then there is a blabla from X to Z.&lt;br /&gt;
There is a blabla from x1 to x2.&lt;br /&gt;
x1 is a bad place.&lt;br /&gt;
There is a blabla from x2 to x3.&lt;br /&gt;
There is a blabla from x2 to bath.&lt;br /&gt;
There is a blabla from x2 to x4.&lt;br /&gt;
x2 is a nice place.&lt;br /&gt;
There is a blabla from x3 to somwhere.&lt;br /&gt;
John is nowhere.&lt;br /&gt;
There is no blabla to hell.&lt;br /&gt;
Is there a blabla from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
------&lt;br /&gt;
&lt;br /&gt;
Works OK:&lt;br /&gt;
&lt;br /&gt;
John had three apples. Mike has two pears.&lt;br /&gt;
Pears and apples are fruits. &lt;br /&gt;
Mike gives all his fruits to John.&lt;br /&gt;
How many fruits does John have?&lt;br /&gt;
&lt;br /&gt;
Does not work ok:&lt;br /&gt;
&lt;br /&gt;
John had three apples. Mike has two pears.&lt;br /&gt;
Pears and apples are fruits. &lt;br /&gt;
Mike eats two pears.&lt;br /&gt;
Mike gives all his fruits to John.&lt;br /&gt;
John eats one apple.&lt;br /&gt;
How many fruits does John have?&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Ei ole OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a white or black spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be white. &lt;br /&gt;
In fact all three spots are white. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
&lt;br /&gt;
Kui see lisada, on OK:&lt;br /&gt;
&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be yellow. &lt;br /&gt;
In fact all three spots are yellow. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be yellow. &lt;br /&gt;
In fact all three spots are not yellow. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be small. &lt;br /&gt;
In fact all three spots are large. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John in the village repairs shoes of all people in the village &lt;br /&gt;
who do not repair their own shoes. &lt;br /&gt;
Does John repair his own shoes?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John in the village shaves beards of all people in the village &lt;br /&gt;
who do not shave their beards. &lt;br /&gt;
Does John shave his own beard?&lt;br /&gt;
&lt;br /&gt;
OK&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 100 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
OK&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 100 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to east. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 80 km to east,&lt;br /&gt;
then 120 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 80 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 1 km to east,&lt;br /&gt;
then 100 km to north, then 2 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 10 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
You are a semantic parser to first order predicate logic. &lt;br /&gt;
Give a logical representation of the sentence &amp;quot;All dogs have a tail&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
???&lt;br /&gt;
&lt;br /&gt;
You are a semantic parser to first order predicate logic.&lt;br /&gt;
Examples: &lt;br /&gt;
&amp;quot;All dogs have a tail&amp;quot; -&amp;gt; All x (dog(x) =&amp;gt; Exists y (tail(y))).&lt;br /&gt;
&amp;quot;All animals have a head&amp;quot; -&amp;gt; All x (animal(x) =&amp;gt; Exists y (head(y))).&lt;br /&gt;
&amp;quot;All bears like honey&amp;quot; -&amp;gt; All x All y (animal(x) &amp;amp; honey(y) =&amp;gt; likes(x,y)).&lt;br /&gt;
&amp;quot;All birds are able to fly&amp;quot; -&amp;gt; All x (bird(x) =&amp;gt; able_to(x,fly)).&lt;br /&gt;
Give a logical representation of the sentence &amp;quot;All mice have a tail&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22100</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22100"/>
		<updated>2025-04-01T07:56:05Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Second lab */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2024|2024]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; about next week, 25. February =&lt;br /&gt;
&lt;br /&gt;
The 25. February lecture will be a recording from 2024 pluss self-study reading and experiments only, not in the lecture room: please see the 25. Feb chapter below.&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Tuesdays 14:00-15:30 room SOC 312/313 (313 weeks 1,3,5,...; 312 weeks 2,4,6,...)&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Wednesdays 12:00-13:30 room U06A-204.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3AmRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81%40thread.tacv2/conversations?groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams] of the course. The code for joining is &lt;br /&gt;
y0bd8e5.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566436916?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566436916&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566436916 teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566518846?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566518846&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566518846 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam, while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials will also come up, but less and/or in a simpler form. The markings will be changed as the course progresses, i.e. the future ones will not necessarily persist!&lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
NB! The details of the third lab are currently from 2024 and will be updated.&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2025 homework part 1|2025 task for the first lab]] is about handling and understanding triplet stores, meaning of rdf types/properties/etc and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change.&lt;br /&gt;
&lt;br /&gt;
Deadline: 5. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
See [[Details of the KR second lab in 2025]]. There are 5 options, you only have to choose one.&lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change. &lt;br /&gt;
&lt;br /&gt;
Deadline: &amp;lt;s&amp;gt;9. April&amp;lt;/s&amp;gt; 16. April&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
These are also not updated yet!&lt;br /&gt;
&lt;br /&gt;
* [[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
* [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]]&lt;br /&gt;
&lt;br /&gt;
Deadline: 14. May.&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin.  [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) [https://web.stanford.edu/~jurafsky/slp3/ here the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/F.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
* [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2024 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 4. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2025.pdf|teadmised_intro2025.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel], [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel],&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 11. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl: 18. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: 25. February ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: looking into main large knowledge bases: 4. March  ===&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors: 11 March ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors].&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM): 18 March ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_intro.pdf|Lecture material]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG: 25 March ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning + open/closed world, planning, frame problem, blocks world. 1 April ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;First, some results/challenges in neurosymbolic reasoning.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]&lt;br /&gt;
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]&lt;br /&gt;
* [https://arcprize.org/ arcprize]. See also [https://liusida.github.io/ARC/ ARC v1 for humans], [https://www.youtube.com/watch?v=jSAT_RuJ_Cg MLST about the state of v1 solvers], [https://www.youtube.com/watch?v=M3b59lZYBW8 MLST video introducing ARC v2]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Second, planning, open/closed worlds and the frame problem. &amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Reasoning with uncertainty and intro to lab 3: 8 April ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links.&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: continue with uncertainty  ===&lt;br /&gt;
&lt;br /&gt;
Numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing  ===&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid: [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued  ===&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning ja konsultatsioon eksamiks ===&lt;br /&gt;
&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22083</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22083"/>
		<updated>2025-03-28T09:33:03Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Practical work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2024|2024]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; about next week, 25. February =&lt;br /&gt;
&lt;br /&gt;
The 25. February lecture will be a recording from 2024 pluss self-study reading and experiments only, not in the lecture room: please see the 25. Feb chapter below.&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Tuesdays 14:00-15:30 room SOC 312/313 (313 weeks 1,3,5,...; 312 weeks 2,4,6,...)&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Wednesdays 12:00-13:30 room U06A-204.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3AmRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81%40thread.tacv2/conversations?groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams] of the course. The code for joining is &lt;br /&gt;
y0bd8e5.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566436916?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566436916&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566436916 teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566518846?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566518846&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566518846 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam, while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials will also come up, but less and/or in a simpler form. The markings will be changed as the course progresses, i.e. the future ones will not necessarily persist!&lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
NB! The details of the third lab are currently from 2024 and will be updated.&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2025 homework part 1|2025 task for the first lab]] is about handling and understanding triplet stores, meaning of rdf types/properties/etc and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change.&lt;br /&gt;
&lt;br /&gt;
Deadline: 5. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
See [[Details of the KR second lab in 2025]]. There are 5 options, you only have to choose one.&lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change. &lt;br /&gt;
&lt;br /&gt;
Deadline: 9. April&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
These are also not updated yet!&lt;br /&gt;
&lt;br /&gt;
* [[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
* [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]]&lt;br /&gt;
&lt;br /&gt;
Deadline: 14. May.&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin.  [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) [https://web.stanford.edu/~jurafsky/slp3/ here the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/F.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
* [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2024 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 4. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2025.pdf|teadmised_intro2025.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel], [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel],&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 11. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl: 18. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: 25. February ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: looking into main large knowledge bases: 4. March  ===&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors: 11 March ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors].&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM): 18 March ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_intro.pdf|Lecture material]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Mida vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Eriti soovitav&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Pikemaks lugemiseks:&lt;br /&gt;
* [https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/ visualizing neural machine translation] and then [https://jalammar.github.io/illustrated-transformer/ the illustrated transformer]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky &amp;amp; Martin: chapter 9, transformers ]&lt;br /&gt;
&amp;lt;!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: chapter 10, transformers and LLMs] --&amp;gt;&lt;br /&gt;
&amp;lt;!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG: 25 March ===&lt;br /&gt;
&lt;br /&gt;
[[Media:Llm_usage_rag.pdf|Lecture material]]&lt;br /&gt;
&lt;br /&gt;
Useful reading in addition to pointers in the lecture material:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning, open/closed world, planning, frame problem, blocks world: 2 April ===&lt;br /&gt;
&lt;br /&gt;
For intro/recalling hybrid neurosymbolic reasoning:&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems]&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
&lt;br /&gt;
We will then consider planning, open/closed worlds and the frame problem. The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Blocks world examples, then reasoning with uncertainty ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links.&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: continue with uncertainty, then intro to lab 3  ===&lt;br /&gt;
&lt;br /&gt;
Numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing  ===&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid: [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued  ===&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning ja konsultatsioon eksamiks ===&lt;br /&gt;
&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Details_of_the_KR_second_lab_in_2025&amp;diff=22074</id>
		<title>Details of the KR second lab in 2025</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Details_of_the_KR_second_lab_in_2025&amp;diff=22074"/>
		<updated>2025-03-19T15:38:28Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* LLMi ise õpetamine (mõõdukalt keeruline, kas windowsis saab, ei tea) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mitu varianti LLMi katsetamine: low level (keerulisemad) kuni high-level (lihtsamad).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= LLMi ise õpetamine (mõõdukalt keeruline, kas windowsis saab, ei tea) =&lt;br /&gt;
&lt;br /&gt;
Linuxis ja Applel mõõdukalt keeruline, Windowsis ei tea, kas saab või ei.&lt;br /&gt;
&lt;br /&gt;
Karpathy nanogpt ([https://youtu.be/kCc8FmEb1nY?si=mDmodHRuQk5XFTVY video], [https://www.youtube.com/playlist?list=PLAqhIrjkxbuWI23v9cThsA9GvCAUhRvKZ videosari], [https://github.com/karpathy/nanoGPT repo]) õpetamine mõne teise korpuse pealt kui &lt;br /&gt;
shakespeare + eksperimenteerimine tekstijätkumise kvaliteediga:&lt;br /&gt;
mis töötab, mis ei. Üks variant on wikipedia tekstiformaat &lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz wikipedia täistekst]&lt;br /&gt;
ja [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz sama lemmatiseeritult]&lt;br /&gt;
&lt;br /&gt;
Eriti hea mõte oleks, kui korpuses on küsimus-vastuspaarid&lt;br /&gt;
mingi konkreetset tüüpi ülesande jaoks, a la lihtsate&lt;br /&gt;
lausete parsimine, aritmeetikatehted, valemite süntaksikontroll,&lt;br /&gt;
väga lihtsa tekstülesande teisendamine pythoni koodiks vms.&lt;br /&gt;
Küsimus-vastuspaare progega genereerida: teed N template ja&lt;br /&gt;
genereerid nendest templatedest!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alternatiiv:&#039;&#039;&#039; Võtta baasmudeliks GPT2 ja peenhäälestada (finetuning) see nanoGPT abil oma andmete abil.&lt;br /&gt;
nanoGPT võimaldab valida baasmudel nelja erineva suurusega GPT2 mudeli hulgast. Kõige väiksem on peenhäälestatav ka ilma GPU-ta arvutil (aega läheb muidugi tunde).&lt;br /&gt;
&lt;br /&gt;
Praktikumis vaadatud Hugging Face&#039;i andmestikud:&lt;br /&gt;
* [https://huggingface.co/datasets/open-thoughts/OpenThoughts-114k OpenThoughts]&lt;br /&gt;
* [https://huggingface.co/datasets/openai/gsm8k GSM8K]&lt;br /&gt;
* [https://huggingface.co/datasets/deepmind/math_dataset math_dataset]&lt;br /&gt;
&lt;br /&gt;
= Berti mõne derivaadi finetunimine spetsiifilise ülesande jaoks =&lt;br /&gt;
&lt;br /&gt;
(keeruline, jällegi, pigem linuxis; sobivate õpetuste leidmine&lt;br /&gt;
ei pruugi olla lihtne)&lt;br /&gt;
&lt;br /&gt;
Vali sobiv Berti variant ja tekita näite-küsimusvastuspaarid&lt;br /&gt;
nagu eelmises ülesandes. &lt;br /&gt;
&lt;br /&gt;
Katseta finetunitud berti: millega ta selle ülesannete klassi&lt;br /&gt;
jaoks veel hakkama saab ja millega mitte eriti.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Väikese teadmusbaasi ise ehitamine LLMi abil =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Build a small knowledge base by asking LLM. What should the knowledge be about? &lt;br /&gt;
Think about something which would be useful to know for some planning or reasoning task, &lt;br /&gt;
like distances between cities, ways to travel from one place to another, features of cities/locations or features/properties of movies, actors, books etc.&lt;br /&gt;
The knowledge base should have some explainable point to it and a limited theme/subject area: you do not want to make it too massive.&lt;br /&gt;
&lt;br /&gt;
As a small example, here is an experimental knowledge base of [http://turing.cs.ttu.ee/~tanel.tammet/sizes_best.csv sizes of objects], built&lt;br /&gt;
by Tanel in a combined way from pre-existing knowledge and by additionally asking LLM. The llm-asking python code is [http://turing.cs.ttu.ee/~tanel.tammet/llmsize.py here] &lt;br /&gt;
and it requires a file &amp;quot;secrets.js&amp;quot; containing the GPT API key like this {&amp;quot;gpt_key&amp;quot;: &amp;quot;sk-wo...2e&amp;quot;} and an existing [http://turing.cs.ttu.ee/~tanel.tammet/sizes1.txt list of words] with their rough sizes. &lt;br /&gt;
&lt;br /&gt;
You may also want to use a large [http://turing.cs.ttu.ee/~tanel.tammet/important_words.txt word/concept list] built by Tanel in a rough order of importance / frequency of use, built by combining three sources:&lt;br /&gt;
is a word known to children, the frequency in English, the number of visits on Wikipedia. NB! This file is ca 370MB: you do not want to open it in a browser.&lt;br /&gt;
&lt;br /&gt;
See [https://arxiv.org/html/2411.04920v1 GPTKB paper] and [https://gptkb.mpi-inf.mpg.de/ GPTKB homepage] for ideas. Your knowledge base does not have to be represented as triples.&lt;br /&gt;
&lt;br /&gt;
= Multishot ülesannete katsetamine LLM-iga =&lt;br /&gt;
&lt;br /&gt;
== OpenAI GPT ==&lt;br /&gt;
https://openai.com/blog/openai-api&lt;br /&gt;
&lt;br /&gt;
ja [http://turing.cs.ttu.ee/~tanel.tammet/gptapi.tar.gz näitekood api lihtsamaks kasutamiseks]&lt;br /&gt;
&lt;br /&gt;
== Teised API võimalused ==&lt;br /&gt;
&lt;br /&gt;
Samad, mis esimeses ülesandes:&lt;br /&gt;
&lt;br /&gt;
* [https://mistral.ai/ mistral.ai] you can try API for free (150.00€/month limit), in exchange your API requests may be used to improve their services.&lt;br /&gt;
&lt;br /&gt;
* [https://together.ai together.ai] that allows you to use open source LLMs for a small fee. Two of their models are available for free: Llama-3.3-70B-Instruct-Turbo-Free and DeepSeek-R1-Distill-Llama-70B-free. They used to have 25$ credit for new users, but this might not be the case anymore.&lt;br /&gt;
&lt;br /&gt;
* [https://aistudio.google.com/ aistudio.google.com] Google AI Studio now also allows to create an API key (includes a free tier), that can be used to make request over Gemini API (see the documentation: https://ai.google.dev/gemini-api/docs) for more information.&lt;br /&gt;
&lt;br /&gt;
* [https://ollama.com/ ollama.com] makes it easy to run free models on local computer. Smaller models run even without GPU.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cheahjs/free-llm-api-resources List of additional resources that have free options]&lt;br /&gt;
&lt;br /&gt;
* [https://console.groq.com/ groqcloud] Mitmed avatud mudelid&lt;br /&gt;
&lt;br /&gt;
== Chat ==&lt;br /&gt;
&lt;br /&gt;
Lisaks ChatGPT-le on palju muid chati võimalusi, millest küll kõik ei toeta veel niinimetatud &#039;&#039;Thinking&#039;&#039; ehk &#039;&#039;Reasoning&#039;&#039; režiimi.&lt;br /&gt;
&lt;br /&gt;
* [https://chat.mistral.ai/chat Mistrali Le Chat]&lt;br /&gt;
* [https://claude.ai/ claude.ai]&lt;br /&gt;
* [https://chat.deepseek.com/ deepseek.com] &lt;br /&gt;
* [https://inference.cerebras.ai/ cerebras inference Deepseek ja Llama]&lt;br /&gt;
* [https://copilot.microsoft.com/ Microsoft copilot]]&lt;br /&gt;
* [https://grok.com/ grok.com]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mida võiks proovida ==&lt;br /&gt;
&lt;br /&gt;
* Võib katsetada Taneli näitepromptidega ja leida, millega hakkama saab ja millega mitte. Hea mõte on leida spetsiifilisem ülesanne ja proovida selle jaoks prompte (N-shot).&lt;br /&gt;
&lt;br /&gt;
* Teisenda LLMi abil loomuliku keele laused logictools-ile (või gkc-le) sobivaks sisendiks (kasuta oma esimeses ülesandes tehtud näiteid).&lt;br /&gt;
&lt;br /&gt;
= Katseta LLMi otsi/järeldamisülesande jaoks = &lt;br /&gt;
&lt;br /&gt;
Katseta nö tavalist LLMi ja LLMi &#039;&#039;Thinking&#039;&#039; ehk &#039;&#039;Reasoning&#039;&#039; režiimi (ei pea olema sama mudel).&lt;br /&gt;
&lt;br /&gt;
Proovi leida keerukuse tase, kus vähemalt tavaline LLM enamasti ebaõnnestub. Võrdle, kuidas saab sama ülesandega hakkama &#039;&#039;Reasoning&#039;&#039; režiimi.&lt;br /&gt;
&lt;br /&gt;
Kuidas teha ülesannet keerulisemaks:&lt;br /&gt;
* Rohkem võimalikke teid ja ummikuid.&lt;br /&gt;
* Kasutada tundmatuid sõnu a la blabla.&lt;br /&gt;
* Lisada ballastteksti.&lt;br /&gt;
&lt;br /&gt;
Kõige parem on katsetada APIga, aga saab ka ilma. Vaata erinevaid võimalusi eelmise ülesande kirjeldusest.&lt;br /&gt;
&lt;br /&gt;
Järgnevad näited on eelmise aasta praksist https://copilot.microsoft.com/ peal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NB!&amp;lt;/b&amp;gt; Pane tähele, et LLMi vastused ei ole stabiilsed: ta võib mingi hetk vastata õieti/valesti, ja paar tundi hiljem teistpidi!&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.  &lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z. &lt;br /&gt;
There is a road from x1 to x2. &lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to x4. &lt;br /&gt;
Is there a road from x4 to x1? &lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
adsas dppdo akka assas .&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
KKKK! Asasas!&lt;br /&gt;
There is a bloo from x1 to x2.&lt;br /&gt;
sdad 103033. 223! sdsad!&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
as sasd aasd asd asd.&lt;br /&gt;
There is a friend from x2 to x4.&lt;br /&gt;
asas asas as. sdoisad, 111.&lt;br /&gt;
Is there a road from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
There is a road from x1 to x2.&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to x4.&lt;br /&gt;
There is a road from x2 to x9.&lt;br /&gt;
There is a road from x4 to x7.&lt;br /&gt;
There is a road from x6 to x10.&lt;br /&gt;
There is a road from x10 to x11.&lt;br /&gt;
There is a road from x11 to x8.&lt;br /&gt;
Is there a road from x8 to x1?&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
There is a road from x1 to x2.&lt;br /&gt;
x1 is a bad place.&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to bath.&lt;br /&gt;
There is a road from x2 to x4.&lt;br /&gt;
x2 is a nice place.&lt;br /&gt;
There is a road from x3 to somwhere.&lt;br /&gt;
John is nowhere.&lt;br /&gt;
There is no road to hell.&lt;br /&gt;
Is there a road from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If there is a blabla from X to Y, then there is a blabla from Y to X.&lt;br /&gt;
If there is a blabla from X to Y and there is a blabla from Y to Z, then there is a blabla from X to Z.&lt;br /&gt;
There is a blabla from x1 to x2.&lt;br /&gt;
x1 is a bad place.&lt;br /&gt;
There is a blabla from x2 to x3.&lt;br /&gt;
There is a blabla from x2 to bath.&lt;br /&gt;
There is a blabla from x2 to x4.&lt;br /&gt;
x2 is a nice place.&lt;br /&gt;
There is a blabla from x3 to somwhere.&lt;br /&gt;
John is nowhere.&lt;br /&gt;
There is no blabla to hell.&lt;br /&gt;
Is there a blabla from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
------&lt;br /&gt;
&lt;br /&gt;
Works OK:&lt;br /&gt;
&lt;br /&gt;
John had three apples. Mike has two pears.&lt;br /&gt;
Pears and apples are fruits. &lt;br /&gt;
Mike gives all his fruits to John.&lt;br /&gt;
How many fruits does John have?&lt;br /&gt;
&lt;br /&gt;
Does not work ok:&lt;br /&gt;
&lt;br /&gt;
John had three apples. Mike has two pears.&lt;br /&gt;
Pears and apples are fruits. &lt;br /&gt;
Mike eats two pears.&lt;br /&gt;
Mike gives all his fruits to John.&lt;br /&gt;
John eats one apple.&lt;br /&gt;
How many fruits does John have?&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Ei ole OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a white or black spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be white. &lt;br /&gt;
In fact all three spots are white. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
&lt;br /&gt;
Kui see lisada, on OK:&lt;br /&gt;
&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be yellow. &lt;br /&gt;
In fact all three spots are yellow. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be yellow. &lt;br /&gt;
In fact all three spots are not yellow. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be small. &lt;br /&gt;
In fact all three spots are large. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John in the village repairs shoes of all people in the village &lt;br /&gt;
who do not repair their own shoes. &lt;br /&gt;
Does John repair his own shoes?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John in the village shaves beards of all people in the village &lt;br /&gt;
who do not shave their beards. &lt;br /&gt;
Does John shave his own beard?&lt;br /&gt;
&lt;br /&gt;
OK&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 100 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
OK&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 100 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to east. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 80 km to east,&lt;br /&gt;
then 120 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 80 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 1 km to east,&lt;br /&gt;
then 100 km to north, then 2 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 10 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
You are a semantic parser to first order predicate logic. &lt;br /&gt;
Give a logical representation of the sentence &amp;quot;All dogs have a tail&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
???&lt;br /&gt;
&lt;br /&gt;
You are a semantic parser to first order predicate logic.&lt;br /&gt;
Examples: &lt;br /&gt;
&amp;quot;All dogs have a tail&amp;quot; -&amp;gt; All x (dog(x) =&amp;gt; Exists y (tail(y))).&lt;br /&gt;
&amp;quot;All animals have a head&amp;quot; -&amp;gt; All x (animal(x) =&amp;gt; Exists y (head(y))).&lt;br /&gt;
&amp;quot;All bears like honey&amp;quot; -&amp;gt; All x All y (animal(x) &amp;amp; honey(y) =&amp;gt; likes(x,y)).&lt;br /&gt;
&amp;quot;All birds are able to fly&amp;quot; -&amp;gt; All x (bird(x) =&amp;gt; able_to(x,fly)).&lt;br /&gt;
Give a logical representation of the sentence &amp;quot;All mice have a tail&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22052</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22052"/>
		<updated>2025-03-12T15:28:33Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Second lab */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2024|2024]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; about next week, 25. February =&lt;br /&gt;
&lt;br /&gt;
The 25. February lecture will be a recording from 2024 pluss self-study reading and experiments only, not in the lecture room: please see the 25. Feb chapter below.&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Tuesdays 14:00-15:30 room SOC 312/313 (313 weeks 1,3,5,...; 312 weeks 2,4,6,...)&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Wednesdays 12:00-13:30 room U06A-204.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3AmRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81%40thread.tacv2/conversations?groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams] of the course. The code for joining is &lt;br /&gt;
y0bd8e5.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566436916?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566436916&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566436916 teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566518846?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566518846&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566518846 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam, while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials will also come up, but less and/or in a simpler form. The markings will be changed as the course progresses, i.e. the future ones will not necessarily persist!&lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
NB! The details of the second and third labs are currently from 2024 and will be updated.&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2025 homework part 1|2025 task for the first lab]] is about handling and understanding triplet stores, meaning of rdf types/properties/etc and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change.&lt;br /&gt;
&lt;br /&gt;
Deadline: 5. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
See [[Details of the KR second lab in 2025]]. There are 5 options, you only have to choose one.&lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change. &lt;br /&gt;
&lt;br /&gt;
Deadline: 9. April&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
These are also not updated yet!&lt;br /&gt;
&lt;br /&gt;
* [[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
* [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]]&lt;br /&gt;
&lt;br /&gt;
Deadline: 14. May.&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin.  [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) [https://web.stanford.edu/~jurafsky/slp3/ here the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/F.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
* [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2024 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 4. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2025.pdf|teadmised_intro2025.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel], [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel],&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 11. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl: 18. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: 25. February ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: looking into main large knowledge bases: 4. March  ===&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://www.ontologyportal.org/ sumo] and [https://adimen.ehu.eus/web/adimenSUMO adimen-sumo], see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors: 11 March ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors].&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM): 18 March ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 14 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Loengus plaanime kasutada:&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: transformers and LLMs]&lt;br /&gt;
* [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :)&lt;br /&gt;
&lt;br /&gt;
Mida lisaks vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Kindlasti&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Transformers and Pretrained Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG ===&lt;br /&gt;
&lt;br /&gt;
Useful reading:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning, open/closed world, planning, frame problem, blocks world ===&lt;br /&gt;
&lt;br /&gt;
For intro/recalling hybrid neurosymbolic reasoning:&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems]&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
&lt;br /&gt;
We will then consider planning, open/closed worlds and the frame problem. The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Blocks world examples, then reasoning with uncertainty ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links.&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: continue with uncertainty, then intro to lab 3: 9 April  ===&lt;br /&gt;
&lt;br /&gt;
Numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge: 16 aprill ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing  ===&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid: [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued  ===&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning ja konsultatsioon eksamiks ===&lt;br /&gt;
&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Details_of_the_KR_second_lab_in_2025&amp;diff=22040</id>
		<title>Details of the KR second lab in 2025</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Details_of_the_KR_second_lab_in_2025&amp;diff=22040"/>
		<updated>2025-03-10T12:13:04Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Väikese teadmusbaasi ise ehitamine LLMi abil */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mitu varianti LLMi katsetamine: low level (keerulisemad) kuni high-level (lihtsamad).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= LLMi ise õpetamine (mõõdukalt keeruline, kas windowsis saab, ei tea) =&lt;br /&gt;
&lt;br /&gt;
Linuxis ja Applel mõõdukalt keeruline, Windowsis ei tea, kas saab või ei.&lt;br /&gt;
&lt;br /&gt;
Karpathy nanogpt ([https://youtu.be/kCc8FmEb1nY?si=mDmodHRuQk5XFTVY video], [https://www.youtube.com/playlist?list=PLAqhIrjkxbuWI23v9cThsA9GvCAUhRvKZ videosari], [https://github.com/karpathy/nanoGPT repo]) õpetamine mõne teise korpuse pealt kui &lt;br /&gt;
shakespeare + eksperimenteerimine tekstijätkumise kvaliteediga:&lt;br /&gt;
mis töötab, mis ei. Üks variant on wikipedia tekstiformaat &lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz wikipedia täistekst]&lt;br /&gt;
ja [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz sama lemmatiseeritult]&lt;br /&gt;
&lt;br /&gt;
Eriti hea mõte oleks, kui korpuses on küsimus-vastuspaarid&lt;br /&gt;
mingi konkreetset tüüpi ülesande jaoks, a la lihtsate&lt;br /&gt;
lausete parsimine, aritmeetikatehted, valemite süntaksikontroll,&lt;br /&gt;
väga lihtsa tekstülesande teisendamine pythoni koodiks vms.&lt;br /&gt;
Küsimus-vastuspaare progega genereerida: teed N template ja&lt;br /&gt;
genereerid nendest templatedest!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alternatiiv:&#039;&#039;&#039; Võtta baasmudeliks GPT2 ja peenhäälestada (finetuning) see nanoGPT abil oma andmete abil.&lt;br /&gt;
nanoGPT võimaldab valida baasmudel nelja erineva suurusega GPT2 mudeli hulgast. Kõige väiksem on peenhäälestatav ka ilma GPU-ta arvutil (aega läheb muidugi tunde).&lt;br /&gt;
&lt;br /&gt;
= Berti mõne derivaadi finetunimine spetsiifilise ülesande jaoks =&lt;br /&gt;
&lt;br /&gt;
(keeruline, jällegi, pigem linuxis; sobivate õpetuste leidmine&lt;br /&gt;
ei pruugi olla lihtne)&lt;br /&gt;
&lt;br /&gt;
Vali sobiv Berti variant ja tekita näite-küsimusvastuspaarid&lt;br /&gt;
nagu eelmises ülesandes. &lt;br /&gt;
&lt;br /&gt;
Katseta finetunitud berti: millega ta selle ülesannete klassi&lt;br /&gt;
jaoks veel hakkama saab ja millega mitte eriti.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Väikese teadmusbaasi ise ehitamine LLMi abil =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Build a small knowledge base by asking LLM. What should the knowledge be about? &lt;br /&gt;
Think about something which would be useful to know for some planning or reasoning task, &lt;br /&gt;
like distances between cities, ways to travel from one place to another, features of cities/locations or features/properties of movies, actors, books etc.&lt;br /&gt;
The knowledge base should have some explainable point to it and a limited theme/subject area: you do not want to make it too massive.&lt;br /&gt;
&lt;br /&gt;
As a small example, here is an experimental knowledge base of [http://turing.cs.ttu.ee/~tanel.tammet/sizes_best.csv sizes of objects], built&lt;br /&gt;
by Tanel in a combined way from pre-existing knowledge and by additionally asking LLM. The llm-asking python code is [http://turing.cs.ttu.ee/~tanel.tammet/llmsize.py here] &lt;br /&gt;
and it requires a file &amp;quot;secrets.js&amp;quot; containing the GPT API key like this {&amp;quot;gpt_key&amp;quot;: &amp;quot;sk-wo...2e&amp;quot;} and an existing [http://turing.cs.ttu.ee/~tanel.tammet/sizes1.txt list of words] with their rough sizes. &lt;br /&gt;
&lt;br /&gt;
You may also want to use a large [http://turing.cs.ttu.ee/~tanel.tammet/important_words.txt word/concept list] built by Tanel in a rough order of importance / frequency of use, built by combining three sources:&lt;br /&gt;
is a word known to children, the frequency in English, the number of visits on Wikipedia. NB! This file is ca 370MB: you do not want to open it in a browser.&lt;br /&gt;
&lt;br /&gt;
See [https://arxiv.org/html/2411.04920v1 GPTKB paper] and [https://gptkb.mpi-inf.mpg.de/ GPTKB homepage] for ideas. Your knowledge base does not have to be represented as triples.&lt;br /&gt;
&lt;br /&gt;
= Multishot ülesannete katsetamine LLM-iga =&lt;br /&gt;
&lt;br /&gt;
== OpenAI GPT ==&lt;br /&gt;
https://openai.com/blog/openai-api&lt;br /&gt;
&lt;br /&gt;
ja [http://turing.cs.ttu.ee/~tanel.tammet/gptapi.tar.gz näitekood api lihtsamaks kasutamiseks]&lt;br /&gt;
&lt;br /&gt;
== Teised API võimalused ==&lt;br /&gt;
&lt;br /&gt;
Samad, mis esimeses ülesandes:&lt;br /&gt;
&lt;br /&gt;
* [https://mistral.ai/ mistral.ai] you can try API for free (150.00€/month limit), in exchange your API requests may be used to improve their services.&lt;br /&gt;
&lt;br /&gt;
* [https://together.ai together.ai] that allows you to use open source LLMs for a small fee. Two of their models are available for free: Llama-3.3-70B-Instruct-Turbo-Free and DeepSeek-R1-Distill-Llama-70B-free. They used to have 25$ credit for new users, but this might not be the case anymore.&lt;br /&gt;
&lt;br /&gt;
* [https://aistudio.google.com/ aistudio.google.com] Google AI Studio now also allows to create an API key (includes a free tier), that can be used to make request over Gemini API (see the documentation: https://ai.google.dev/gemini-api/docs) for more information.&lt;br /&gt;
&lt;br /&gt;
* [https://ollama.com/ ollama.com] makes it easy to run free models on local computer. Smaller models run even without GPU.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cheahjs/free-llm-api-resources List of additional resources that have free options]&lt;br /&gt;
&lt;br /&gt;
* [https://console.groq.com/ groqcloud] Mitmed avatud mudelid&lt;br /&gt;
&lt;br /&gt;
== Chat ==&lt;br /&gt;
&lt;br /&gt;
Lisaks ChatGPT-le on palju muid chati võimalusi, millest küll kõik ei toeta veel niinimetatud &#039;&#039;Thinking&#039;&#039; ehk &#039;&#039;Reasoning&#039;&#039; režiimi.&lt;br /&gt;
&lt;br /&gt;
* [https://chat.mistral.ai/chat Mistrali Le Chat]&lt;br /&gt;
* [https://claude.ai/ claude.ai]&lt;br /&gt;
* [https://chat.deepseek.com/ deepseek.com] &lt;br /&gt;
* [https://inference.cerebras.ai/ cerebras inference Deepseek ja Llama]&lt;br /&gt;
* [https://copilot.microsoft.com/ Microsoft copilot]]&lt;br /&gt;
* [https://grok.com/ grok.com]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mida võiks proovida ==&lt;br /&gt;
&lt;br /&gt;
* Võib katsetada Taneli näitepromptidega ja leida, millega hakkama saab ja millega mitte. Hea mõte on leida spetsiifilisem ülesanne ja proovida selle jaoks prompte (N-shot).&lt;br /&gt;
&lt;br /&gt;
* Teisenda LLMi abil loomuliku keele laused logictools-ile (või gkc-le) sobivaks sisendiks (kasuta oma esimeses ülesandes tehtud näiteid).&lt;br /&gt;
&lt;br /&gt;
= Katseta LLMi otsi/järeldamisülesande jaoks = &lt;br /&gt;
&lt;br /&gt;
Katseta nö tavalist LLMi ja LLMi &#039;&#039;Thinking&#039;&#039; ehk &#039;&#039;Reasoning&#039;&#039; režiimi (ei pea olema sama mudel).&lt;br /&gt;
&lt;br /&gt;
Proovi leida keerukuse tase, kus vähemalt tavaline LLM enamasti ebaõnnestub. Võrdle, kuidas saab sama ülesandega hakkama &#039;&#039;Reasoning&#039;&#039; režiimi.&lt;br /&gt;
&lt;br /&gt;
Kuidas teha ülesannet keerulisemaks:&lt;br /&gt;
* Rohkem võimalikke teid ja ummikuid.&lt;br /&gt;
* Kasutada tundmatuid sõnu a la blabla.&lt;br /&gt;
* Lisada ballastteksti.&lt;br /&gt;
&lt;br /&gt;
Kõige parem on katsetada APIga, aga saab ka ilma. Vaata erinevaid võimalusi eelmise ülesande kirjeldusest.&lt;br /&gt;
&lt;br /&gt;
Järgnevad näited on eelmise aasta praksist https://copilot.microsoft.com/ peal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NB!&amp;lt;/b&amp;gt; Pane tähele, et LLMi vastused ei ole stabiilsed: ta võib mingi hetk vastata õieti/valesti, ja paar tundi hiljem teistpidi!&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.  &lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z. &lt;br /&gt;
There is a road from x1 to x2. &lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to x4. &lt;br /&gt;
Is there a road from x4 to x1? &lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
adsas dppdo akka assas .&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
KKKK! Asasas!&lt;br /&gt;
There is a bloo from x1 to x2.&lt;br /&gt;
sdad 103033. 223! sdsad!&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
as sasd aasd asd asd.&lt;br /&gt;
There is a friend from x2 to x4.&lt;br /&gt;
asas asas as. sdoisad, 111.&lt;br /&gt;
Is there a road from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
There is a road from x1 to x2.&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to x4.&lt;br /&gt;
There is a road from x2 to x9.&lt;br /&gt;
There is a road from x4 to x7.&lt;br /&gt;
There is a road from x6 to x10.&lt;br /&gt;
There is a road from x10 to x11.&lt;br /&gt;
There is a road from x11 to x8.&lt;br /&gt;
Is there a road from x8 to x1?&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
There is a road from x1 to x2.&lt;br /&gt;
x1 is a bad place.&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to bath.&lt;br /&gt;
There is a road from x2 to x4.&lt;br /&gt;
x2 is a nice place.&lt;br /&gt;
There is a road from x3 to somwhere.&lt;br /&gt;
John is nowhere.&lt;br /&gt;
There is no road to hell.&lt;br /&gt;
Is there a road from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If there is a blabla from X to Y, then there is a blabla from Y to X.&lt;br /&gt;
If there is a blabla from X to Y and there is a blabla from Y to Z, then there is a blabla from X to Z.&lt;br /&gt;
There is a blabla from x1 to x2.&lt;br /&gt;
x1 is a bad place.&lt;br /&gt;
There is a blabla from x2 to x3.&lt;br /&gt;
There is a blabla from x2 to bath.&lt;br /&gt;
There is a blabla from x2 to x4.&lt;br /&gt;
x2 is a nice place.&lt;br /&gt;
There is a blabla from x3 to somwhere.&lt;br /&gt;
John is nowhere.&lt;br /&gt;
There is no blabla to hell.&lt;br /&gt;
Is there a blabla from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
------&lt;br /&gt;
&lt;br /&gt;
Works OK:&lt;br /&gt;
&lt;br /&gt;
John had three apples. Mike has two pears.&lt;br /&gt;
Pears and apples are fruits. &lt;br /&gt;
Mike gives all his fruits to John.&lt;br /&gt;
How many fruits does John have?&lt;br /&gt;
&lt;br /&gt;
Does not work ok:&lt;br /&gt;
&lt;br /&gt;
John had three apples. Mike has two pears.&lt;br /&gt;
Pears and apples are fruits. &lt;br /&gt;
Mike eats two pears.&lt;br /&gt;
Mike gives all his fruits to John.&lt;br /&gt;
John eats one apple.&lt;br /&gt;
How many fruits does John have?&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Ei ole OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a white or black spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be white. &lt;br /&gt;
In fact all three spots are white. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
&lt;br /&gt;
Kui see lisada, on OK:&lt;br /&gt;
&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be yellow. &lt;br /&gt;
In fact all three spots are yellow. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be yellow. &lt;br /&gt;
In fact all three spots are not yellow. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be small. &lt;br /&gt;
In fact all three spots are large. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John in the village repairs shoes of all people in the village &lt;br /&gt;
who do not repair their own shoes. &lt;br /&gt;
Does John repair his own shoes?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John in the village shaves beards of all people in the village &lt;br /&gt;
who do not shave their beards. &lt;br /&gt;
Does John shave his own beard?&lt;br /&gt;
&lt;br /&gt;
OK&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 100 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
OK&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 100 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to east. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 80 km to east,&lt;br /&gt;
then 120 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 80 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 1 km to east,&lt;br /&gt;
then 100 km to north, then 2 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 10 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
You are a semantic parser to first order predicate logic. &lt;br /&gt;
Give a logical representation of the sentence &amp;quot;All dogs have a tail&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
???&lt;br /&gt;
&lt;br /&gt;
You are a semantic parser to first order predicate logic.&lt;br /&gt;
Examples: &lt;br /&gt;
&amp;quot;All dogs have a tail&amp;quot; -&amp;gt; All x (dog(x) =&amp;gt; Exists y (tail(y))).&lt;br /&gt;
&amp;quot;All animals have a head&amp;quot; -&amp;gt; All x (animal(x) =&amp;gt; Exists y (head(y))).&lt;br /&gt;
&amp;quot;All bears like honey&amp;quot; -&amp;gt; All x All y (animal(x) &amp;amp; honey(y) =&amp;gt; likes(x,y)).&lt;br /&gt;
&amp;quot;All birds are able to fly&amp;quot; -&amp;gt; All x (bird(x) =&amp;gt; able_to(x,fly)).&lt;br /&gt;
Give a logical representation of the sentence &amp;quot;All mice have a tail&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Details_of_the_KR_second_lab_in_2025&amp;diff=22039</id>
		<title>Details of the KR second lab in 2025</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Details_of_the_KR_second_lab_in_2025&amp;diff=22039"/>
		<updated>2025-03-10T11:33:20Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Katseta LLMi otsi/järeldamisülesande jaoks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mitu varianti LLMi katsetamine: low level (keerulisemad) kuni high-level (lihtsamad).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= LLMi ise õpetamine (mõõdukalt keeruline, kas windowsis saab, ei tea) =&lt;br /&gt;
&lt;br /&gt;
Linuxis ja Applel mõõdukalt keeruline, Windowsis ei tea, kas saab või ei.&lt;br /&gt;
&lt;br /&gt;
Karpathy nanogpt ([https://youtu.be/kCc8FmEb1nY?si=mDmodHRuQk5XFTVY video], [https://www.youtube.com/playlist?list=PLAqhIrjkxbuWI23v9cThsA9GvCAUhRvKZ videosari], [https://github.com/karpathy/nanoGPT repo]) õpetamine mõne teise korpuse pealt kui &lt;br /&gt;
shakespeare + eksperimenteerimine tekstijätkumise kvaliteediga:&lt;br /&gt;
mis töötab, mis ei. Üks variant on wikipedia tekstiformaat &lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz wikipedia täistekst]&lt;br /&gt;
ja [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz sama lemmatiseeritult]&lt;br /&gt;
&lt;br /&gt;
Eriti hea mõte oleks, kui korpuses on küsimus-vastuspaarid&lt;br /&gt;
mingi konkreetset tüüpi ülesande jaoks, a la lihtsate&lt;br /&gt;
lausete parsimine, aritmeetikatehted, valemite süntaksikontroll,&lt;br /&gt;
väga lihtsa tekstülesande teisendamine pythoni koodiks vms.&lt;br /&gt;
Küsimus-vastuspaare progega genereerida: teed N template ja&lt;br /&gt;
genereerid nendest templatedest!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alternatiiv:&#039;&#039;&#039; Võtta baasmudeliks GPT2 ja peenhäälestada (finetuning) see nanoGPT abil oma andmete abil.&lt;br /&gt;
nanoGPT võimaldab valida baasmudel nelja erineva suurusega GPT2 mudeli hulgast. Kõige väiksem on peenhäälestatav ka ilma GPU-ta arvutil (aega läheb muidugi tunde).&lt;br /&gt;
&lt;br /&gt;
= Berti mõne derivaadi finetunimine spetsiifilise ülesande jaoks =&lt;br /&gt;
&lt;br /&gt;
(keeruline, jällegi, pigem linuxis; sobivate õpetuste leidmine&lt;br /&gt;
ei pruugi olla lihtne)&lt;br /&gt;
&lt;br /&gt;
Vali sobiv Berti variant ja tekita näite-küsimusvastuspaarid&lt;br /&gt;
nagu eelmises ülesandes. &lt;br /&gt;
&lt;br /&gt;
Katseta finetunitud berti: millega ta selle ülesannete klassi&lt;br /&gt;
jaoks veel hakkama saab ja millega mitte eriti.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Väikese teadmusbaasi ise ehitamine LLMi abil =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Build a small knowledge base by asking LLM. What should the knowledge be about? &lt;br /&gt;
Think about something which would be useful to know for some planning or reasoning task, &lt;br /&gt;
like distances between cities, ways to travel from one place to another, features of cities/locations or features/properties of movies, actors, books etc.&lt;br /&gt;
The knowledge base should have some explainable point to it and a limited theme/subject area: you do not want to make it too massive.&lt;br /&gt;
&lt;br /&gt;
As a small example, here is an experimental knowledge base of [http://turing.cs.ttu.ee/~tanel.tammet/sizes_best.csv sizes of objects], built&lt;br /&gt;
by Tanel in a combined way from pre-existing knowledge and by additionally asking LLM. The llm-asking python code is [http://turing.cs.ttu.ee/~tanel.tammet/llmsize.py here] &lt;br /&gt;
and it requires a file &amp;quot;secrets.js&amp;quot; containing the GPT API key like this {&amp;quot;gpt_key&amp;quot;: &amp;quot;sk-wo...2e&amp;quot;} and an existing [http://turing.cs.ttu.ee/~tanel.tammet/sizes1.txt list of words] with their rough sizes. &lt;br /&gt;
&lt;br /&gt;
You may also want to use a large [http://turing.cs.ttu.ee/~tanel.tammet/important_words.txt word/concept list] built by Tanel in a rough order of importance / frequency of use, built by combining three sources:&lt;br /&gt;
is a word known to children, the frequency in English, the number of visits on Wikipedia. NB! This file is ca 370MB: you do not want to open it in a browser.&lt;br /&gt;
&lt;br /&gt;
= Multishot ülesannete katsetamine LLM-iga =&lt;br /&gt;
&lt;br /&gt;
== OpenAI GPT ==&lt;br /&gt;
https://openai.com/blog/openai-api&lt;br /&gt;
&lt;br /&gt;
ja [http://turing.cs.ttu.ee/~tanel.tammet/gptapi.tar.gz näitekood api lihtsamaks kasutamiseks]&lt;br /&gt;
&lt;br /&gt;
== Teised API võimalused ==&lt;br /&gt;
&lt;br /&gt;
Samad, mis esimeses ülesandes:&lt;br /&gt;
&lt;br /&gt;
* [https://mistral.ai/ mistral.ai] you can try API for free (150.00€/month limit), in exchange your API requests may be used to improve their services.&lt;br /&gt;
&lt;br /&gt;
* [https://together.ai together.ai] that allows you to use open source LLMs for a small fee. Two of their models are available for free: Llama-3.3-70B-Instruct-Turbo-Free and DeepSeek-R1-Distill-Llama-70B-free. They used to have 25$ credit for new users, but this might not be the case anymore.&lt;br /&gt;
&lt;br /&gt;
* [https://aistudio.google.com/ aistudio.google.com] Google AI Studio now also allows to create an API key (includes a free tier), that can be used to make request over Gemini API (see the documentation: https://ai.google.dev/gemini-api/docs) for more information.&lt;br /&gt;
&lt;br /&gt;
* [https://ollama.com/ ollama.com] makes it easy to run free models on local computer. Smaller models run even without GPU.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cheahjs/free-llm-api-resources List of additional resources that have free options]&lt;br /&gt;
&lt;br /&gt;
* [https://console.groq.com/ groqcloud] Mitmed avatud mudelid&lt;br /&gt;
&lt;br /&gt;
== Chat ==&lt;br /&gt;
&lt;br /&gt;
Lisaks ChatGPT-le on palju muid chati võimalusi, millest küll kõik ei toeta veel niinimetatud &#039;&#039;Thinking&#039;&#039; ehk &#039;&#039;Reasoning&#039;&#039; režiimi.&lt;br /&gt;
&lt;br /&gt;
* [https://chat.mistral.ai/chat Mistrali Le Chat]&lt;br /&gt;
* [https://claude.ai/ claude.ai]&lt;br /&gt;
* [https://chat.deepseek.com/ deepseek.com] &lt;br /&gt;
* [https://inference.cerebras.ai/ cerebras inference Deepseek ja Llama]&lt;br /&gt;
* [https://copilot.microsoft.com/ Microsoft copilot]]&lt;br /&gt;
* [https://grok.com/ grok.com]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mida võiks proovida ==&lt;br /&gt;
&lt;br /&gt;
* Võib katsetada Taneli näitepromptidega ja leida, millega hakkama saab ja millega mitte. Hea mõte on leida spetsiifilisem ülesanne ja proovida selle jaoks prompte (N-shot).&lt;br /&gt;
&lt;br /&gt;
* Teisenda LLMi abil loomuliku keele laused logictools-ile (või gkc-le) sobivaks sisendiks (kasuta oma esimeses ülesandes tehtud näiteid).&lt;br /&gt;
&lt;br /&gt;
= Katseta LLMi otsi/järeldamisülesande jaoks = &lt;br /&gt;
&lt;br /&gt;
Katseta nö tavalist LLMi ja LLMi &#039;&#039;Thinking&#039;&#039; ehk &#039;&#039;Reasoning&#039;&#039; režiimi (ei pea olema sama mudel).&lt;br /&gt;
&lt;br /&gt;
Proovi leida keerukuse tase, kus vähemalt tavaline LLM enamasti ebaõnnestub. Võrdle, kuidas saab sama ülesandega hakkama &#039;&#039;Reasoning&#039;&#039; režiimi.&lt;br /&gt;
&lt;br /&gt;
Kuidas teha ülesannet keerulisemaks:&lt;br /&gt;
* Rohkem võimalikke teid ja ummikuid.&lt;br /&gt;
* Kasutada tundmatuid sõnu a la blabla.&lt;br /&gt;
* Lisada ballastteksti.&lt;br /&gt;
&lt;br /&gt;
Kõige parem on katsetada APIga, aga saab ka ilma. Vaata erinevaid võimalusi eelmise ülesande kirjeldusest.&lt;br /&gt;
&lt;br /&gt;
Järgnevad näited on eelmise aasta praksist https://copilot.microsoft.com/ peal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NB!&amp;lt;/b&amp;gt; Pane tähele, et LLMi vastused ei ole stabiilsed: ta võib mingi hetk vastata õieti/valesti, ja paar tundi hiljem teistpidi!&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.  &lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z. &lt;br /&gt;
There is a road from x1 to x2. &lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to x4. &lt;br /&gt;
Is there a road from x4 to x1? &lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
adsas dppdo akka assas .&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
KKKK! Asasas!&lt;br /&gt;
There is a bloo from x1 to x2.&lt;br /&gt;
sdad 103033. 223! sdsad!&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
as sasd aasd asd asd.&lt;br /&gt;
There is a friend from x2 to x4.&lt;br /&gt;
asas asas as. sdoisad, 111.&lt;br /&gt;
Is there a road from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
There is a road from x1 to x2.&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to x4.&lt;br /&gt;
There is a road from x2 to x9.&lt;br /&gt;
There is a road from x4 to x7.&lt;br /&gt;
There is a road from x6 to x10.&lt;br /&gt;
There is a road from x10 to x11.&lt;br /&gt;
There is a road from x11 to x8.&lt;br /&gt;
Is there a road from x8 to x1?&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
There is a road from x1 to x2.&lt;br /&gt;
x1 is a bad place.&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to bath.&lt;br /&gt;
There is a road from x2 to x4.&lt;br /&gt;
x2 is a nice place.&lt;br /&gt;
There is a road from x3 to somwhere.&lt;br /&gt;
John is nowhere.&lt;br /&gt;
There is no road to hell.&lt;br /&gt;
Is there a road from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If there is a blabla from X to Y, then there is a blabla from Y to X.&lt;br /&gt;
If there is a blabla from X to Y and there is a blabla from Y to Z, then there is a blabla from X to Z.&lt;br /&gt;
There is a blabla from x1 to x2.&lt;br /&gt;
x1 is a bad place.&lt;br /&gt;
There is a blabla from x2 to x3.&lt;br /&gt;
There is a blabla from x2 to bath.&lt;br /&gt;
There is a blabla from x2 to x4.&lt;br /&gt;
x2 is a nice place.&lt;br /&gt;
There is a blabla from x3 to somwhere.&lt;br /&gt;
John is nowhere.&lt;br /&gt;
There is no blabla to hell.&lt;br /&gt;
Is there a blabla from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
------&lt;br /&gt;
&lt;br /&gt;
Works OK:&lt;br /&gt;
&lt;br /&gt;
John had three apples. Mike has two pears.&lt;br /&gt;
Pears and apples are fruits. &lt;br /&gt;
Mike gives all his fruits to John.&lt;br /&gt;
How many fruits does John have?&lt;br /&gt;
&lt;br /&gt;
Does not work ok:&lt;br /&gt;
&lt;br /&gt;
John had three apples. Mike has two pears.&lt;br /&gt;
Pears and apples are fruits. &lt;br /&gt;
Mike eats two pears.&lt;br /&gt;
Mike gives all his fruits to John.&lt;br /&gt;
John eats one apple.&lt;br /&gt;
How many fruits does John have?&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Ei ole OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a white or black spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be white. &lt;br /&gt;
In fact all three spots are white. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
&lt;br /&gt;
Kui see lisada, on OK:&lt;br /&gt;
&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be yellow. &lt;br /&gt;
In fact all three spots are yellow. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be yellow. &lt;br /&gt;
In fact all three spots are not yellow. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be small. &lt;br /&gt;
In fact all three spots are large. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John in the village repairs shoes of all people in the village &lt;br /&gt;
who do not repair their own shoes. &lt;br /&gt;
Does John repair his own shoes?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John in the village shaves beards of all people in the village &lt;br /&gt;
who do not shave their beards. &lt;br /&gt;
Does John shave his own beard?&lt;br /&gt;
&lt;br /&gt;
OK&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 100 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
OK&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 100 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to east. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 80 km to east,&lt;br /&gt;
then 120 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 80 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 1 km to east,&lt;br /&gt;
then 100 km to north, then 2 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 10 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
You are a semantic parser to first order predicate logic. &lt;br /&gt;
Give a logical representation of the sentence &amp;quot;All dogs have a tail&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
???&lt;br /&gt;
&lt;br /&gt;
You are a semantic parser to first order predicate logic.&lt;br /&gt;
Examples: &lt;br /&gt;
&amp;quot;All dogs have a tail&amp;quot; -&amp;gt; All x (dog(x) =&amp;gt; Exists y (tail(y))).&lt;br /&gt;
&amp;quot;All animals have a head&amp;quot; -&amp;gt; All x (animal(x) =&amp;gt; Exists y (head(y))).&lt;br /&gt;
&amp;quot;All bears like honey&amp;quot; -&amp;gt; All x All y (animal(x) &amp;amp; honey(y) =&amp;gt; likes(x,y)).&lt;br /&gt;
&amp;quot;All birds are able to fly&amp;quot; -&amp;gt; All x (bird(x) =&amp;gt; able_to(x,fly)).&lt;br /&gt;
Give a logical representation of the sentence &amp;quot;All mice have a tail&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Details_of_the_KR_second_lab_in_2025&amp;diff=22038</id>
		<title>Details of the KR second lab in 2025</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Details_of_the_KR_second_lab_in_2025&amp;diff=22038"/>
		<updated>2025-03-10T11:00:28Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Katseta LLMi otsi/järeldamisülesande jaoks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mitu varianti LLMi katsetamine: low level (keerulisemad) kuni high-level (lihtsamad).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= LLMi ise õpetamine (mõõdukalt keeruline, kas windowsis saab, ei tea) =&lt;br /&gt;
&lt;br /&gt;
Linuxis ja Applel mõõdukalt keeruline, Windowsis ei tea, kas saab või ei.&lt;br /&gt;
&lt;br /&gt;
Karpathy nanogpt ([https://youtu.be/kCc8FmEb1nY?si=mDmodHRuQk5XFTVY video], [https://www.youtube.com/playlist?list=PLAqhIrjkxbuWI23v9cThsA9GvCAUhRvKZ videosari], [https://github.com/karpathy/nanoGPT repo]) õpetamine mõne teise korpuse pealt kui &lt;br /&gt;
shakespeare + eksperimenteerimine tekstijätkumise kvaliteediga:&lt;br /&gt;
mis töötab, mis ei. Üks variant on wikipedia tekstiformaat &lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz wikipedia täistekst]&lt;br /&gt;
ja [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz sama lemmatiseeritult]&lt;br /&gt;
&lt;br /&gt;
Eriti hea mõte oleks, kui korpuses on küsimus-vastuspaarid&lt;br /&gt;
mingi konkreetset tüüpi ülesande jaoks, a la lihtsate&lt;br /&gt;
lausete parsimine, aritmeetikatehted, valemite süntaksikontroll,&lt;br /&gt;
väga lihtsa tekstülesande teisendamine pythoni koodiks vms.&lt;br /&gt;
Küsimus-vastuspaare progega genereerida: teed N template ja&lt;br /&gt;
genereerid nendest templatedest!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alternatiiv:&#039;&#039;&#039; Võtta baasmudeliks GPT2 ja peenhäälestada (finetuning) see nanoGPT abil oma andmete abil.&lt;br /&gt;
nanoGPT võimaldab valida baasmudel nelja erineva suurusega GPT2 mudeli hulgast. Kõige väiksem on peenhäälestatav ka ilma GPU-ta arvutil (aega läheb muidugi tunde).&lt;br /&gt;
&lt;br /&gt;
= Berti mõne derivaadi finetunimine spetsiifilise ülesande jaoks =&lt;br /&gt;
&lt;br /&gt;
(keeruline, jällegi, pigem linuxis; sobivate õpetuste leidmine&lt;br /&gt;
ei pruugi olla lihtne)&lt;br /&gt;
&lt;br /&gt;
Vali sobiv Berti variant ja tekita näite-küsimusvastuspaarid&lt;br /&gt;
nagu eelmises ülesandes. &lt;br /&gt;
&lt;br /&gt;
Katseta finetunitud berti: millega ta selle ülesannete klassi&lt;br /&gt;
jaoks veel hakkama saab ja millega mitte eriti.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Väikese teadmusbaasi ise ehitamine LLMi abil =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Build a small knowledge base by asking LLM. What should the knowledge be about? &lt;br /&gt;
Think about something which would be useful to know for some planning or reasoning task, &lt;br /&gt;
like distances between cities, ways to travel from one place to another, features of cities/locations or features/properties of movies, actors, books etc.&lt;br /&gt;
The knowledge base should have some explainable point to it and a limited theme/subject area: you do not want to make it too massive.&lt;br /&gt;
&lt;br /&gt;
As a small example, here is an experimental knowledge base of [http://turing.cs.ttu.ee/~tanel.tammet/sizes_best.csv sizes of objects], built&lt;br /&gt;
by Tanel in a combined way from pre-existing knowledge and by additionally asking LLM. The llm-asking python code is [http://turing.cs.ttu.ee/~tanel.tammet/llmsize.py here] &lt;br /&gt;
and it requires a file &amp;quot;secrets.js&amp;quot; containing the GPT API key like this {&amp;quot;gpt_key&amp;quot;: &amp;quot;sk-wo...2e&amp;quot;} and an existing [http://turing.cs.ttu.ee/~tanel.tammet/sizes1.txt list of words] with their rough sizes. &lt;br /&gt;
&lt;br /&gt;
You may also want to use a large [http://turing.cs.ttu.ee/~tanel.tammet/important_words.txt word/concept list] built by Tanel in a rough order of importance / frequency of use, built by combining three sources:&lt;br /&gt;
is a word known to children, the frequency in English, the number of visits on Wikipedia. NB! This file is ca 370MB: you do not want to open it in a browser.&lt;br /&gt;
&lt;br /&gt;
= Multishot ülesannete katsetamine LLM-iga =&lt;br /&gt;
&lt;br /&gt;
== OpenAI GPT ==&lt;br /&gt;
https://openai.com/blog/openai-api&lt;br /&gt;
&lt;br /&gt;
ja [http://turing.cs.ttu.ee/~tanel.tammet/gptapi.tar.gz näitekood api lihtsamaks kasutamiseks]&lt;br /&gt;
&lt;br /&gt;
== Teised API võimalused ==&lt;br /&gt;
&lt;br /&gt;
Samad, mis esimeses ülesandes:&lt;br /&gt;
&lt;br /&gt;
* [https://mistral.ai/ mistral.ai] you can try API for free (150.00€/month limit), in exchange your API requests may be used to improve their services.&lt;br /&gt;
&lt;br /&gt;
* [https://together.ai together.ai] that allows you to use open source LLMs for a small fee. Two of their models are available for free: Llama-3.3-70B-Instruct-Turbo-Free and DeepSeek-R1-Distill-Llama-70B-free. They used to have 25$ credit for new users, but this might not be the case anymore.&lt;br /&gt;
&lt;br /&gt;
* [https://aistudio.google.com/ aistudio.google.com] Google AI Studio now also allows to create an API key (includes a free tier), that can be used to make request over Gemini API (see the documentation: https://ai.google.dev/gemini-api/docs) for more information.&lt;br /&gt;
&lt;br /&gt;
* [https://ollama.com/ ollama.com] makes it easy to run free models on local computer. Smaller models run even without GPU.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cheahjs/free-llm-api-resources List of additional resources that have free options]&lt;br /&gt;
&lt;br /&gt;
* [https://console.groq.com/ groqcloud] Mitmed avatud mudelid&lt;br /&gt;
&lt;br /&gt;
== Chat ==&lt;br /&gt;
&lt;br /&gt;
Lisaks ChatGPT-le on palju muid chati võimalusi, millest küll kõik ei toeta veel niinimetatud &#039;&#039;Thinking&#039;&#039; ehk &#039;&#039;Reasoning&#039;&#039; režiimi.&lt;br /&gt;
&lt;br /&gt;
* [https://chat.mistral.ai/chat Mistrali Le Chat]&lt;br /&gt;
* [https://claude.ai/ claude.ai]&lt;br /&gt;
* [https://chat.deepseek.com/ deepseek.com] &lt;br /&gt;
* [https://inference.cerebras.ai/ cerebras inference Deepseek ja Llama]&lt;br /&gt;
* [https://copilot.microsoft.com/ Microsoft copilot]]&lt;br /&gt;
* [https://grok.com/ grok.com]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mida võiks proovida ==&lt;br /&gt;
&lt;br /&gt;
* Võib katsetada Taneli näitepromptidega ja leida, millega hakkama saab ja millega mitte. Hea mõte on leida spetsiifilisem ülesanne ja proovida selle jaoks prompte (N-shot).&lt;br /&gt;
&lt;br /&gt;
* Teisenda LLMi abil loomuliku keele laused logictools-ile (või gkc-le) sobivaks sisendiks (kasuta oma esimeses ülesandes tehtud näiteid).&lt;br /&gt;
&lt;br /&gt;
= Katseta LLMi otsi/järeldamisülesande jaoks = &lt;br /&gt;
&lt;br /&gt;
Katseta nö tavalist LLMi ja LLMi &#039;&#039;Thinking&#039;&#039; ehk &#039;&#039;Reasoning&#039;&#039; režiimi (ei pea olema sama mudel).&lt;br /&gt;
&lt;br /&gt;
Proovi leida keerukuse tase, kus vähemalt tavaline LLM enamasti ebaõnnestub. Võrdle, kuidas saab sama ülesandega hakkama &#039;&#039;Reasoning&#039;&#039; režiimi.&lt;br /&gt;
&lt;br /&gt;
Kuidas teha ülesannet keerulisemaks:&lt;br /&gt;
* Rohkem võimalikke teid ja ummikuid.&lt;br /&gt;
* Kasutada tundmatuid sõnu a la blabla.&lt;br /&gt;
* Lisada ballastteksti.&lt;br /&gt;
&lt;br /&gt;
Kõige parem on katsetada APIga, aga saab ka ilma. Vaata erinevaid võimalusi eelmise ülesande kirjeldusest.&lt;br /&gt;
&lt;br /&gt;
Järgnevad näited on eelmise aasta praksist https://copilot.microsoft.com/ peal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NB!&amp;lt;/b&amp;gt; Pane tähele, et gpt vastused ei ole stabiilsed: ta võib mingi hetk vastata õieti/valesti, ja paar tundi hiljem teistpidi!&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.  &lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z. &lt;br /&gt;
There is a road from x1 to x2. &lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to x4. &lt;br /&gt;
Is there a road from x4 to x1? &lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
adsas dppdo akka assas .&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
KKKK! Asasas!&lt;br /&gt;
There is a bloo from x1 to x2.&lt;br /&gt;
sdad 103033. 223! sdsad!&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
as sasd aasd asd asd.&lt;br /&gt;
There is a friend from x2 to x4.&lt;br /&gt;
asas asas as. sdoisad, 111.&lt;br /&gt;
Is there a road from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
There is a road from x1 to x2.&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to x4.&lt;br /&gt;
There is a road from x2 to x9.&lt;br /&gt;
There is a road from x4 to x7.&lt;br /&gt;
There is a road from x6 to x10.&lt;br /&gt;
There is a road from x10 to x11.&lt;br /&gt;
There is a road from x11 to x8.&lt;br /&gt;
Is there a road from x8 to x1?&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
There is a road from x1 to x2.&lt;br /&gt;
x1 is a bad place.&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to bath.&lt;br /&gt;
There is a road from x2 to x4.&lt;br /&gt;
x2 is a nice place.&lt;br /&gt;
There is a road from x3 to somwhere.&lt;br /&gt;
John is nowhere.&lt;br /&gt;
There is no road to hell.&lt;br /&gt;
Is there a road from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If there is a blabla from X to Y, then there is a blabla from Y to X.&lt;br /&gt;
If there is a blabla from X to Y and there is a blabla from Y to Z, then there is a blabla from X to Z.&lt;br /&gt;
There is a blabla from x1 to x2.&lt;br /&gt;
x1 is a bad place.&lt;br /&gt;
There is a blabla from x2 to x3.&lt;br /&gt;
There is a blabla from x2 to bath.&lt;br /&gt;
There is a blabla from x2 to x4.&lt;br /&gt;
x2 is a nice place.&lt;br /&gt;
There is a blabla from x3 to somwhere.&lt;br /&gt;
John is nowhere.&lt;br /&gt;
There is no blabla to hell.&lt;br /&gt;
Is there a blabla from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
------&lt;br /&gt;
&lt;br /&gt;
Works OK:&lt;br /&gt;
&lt;br /&gt;
John had three apples. Mike has two pears.&lt;br /&gt;
Pears and apples are fruits. &lt;br /&gt;
Mike gives all his fruits to John.&lt;br /&gt;
How many fruits does John have?&lt;br /&gt;
&lt;br /&gt;
Does not work ok:&lt;br /&gt;
&lt;br /&gt;
John had three apples. Mike has two pears.&lt;br /&gt;
Pears and apples are fruits. &lt;br /&gt;
Mike eats two pears.&lt;br /&gt;
Mike gives all his fruits to John.&lt;br /&gt;
John eats one apple.&lt;br /&gt;
How many fruits does John have?&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Ei ole OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a white or black spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be white. &lt;br /&gt;
In fact all three spots are white. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
&lt;br /&gt;
Kui see lisada, on OK:&lt;br /&gt;
&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be yellow. &lt;br /&gt;
In fact all three spots are yellow. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be yellow. &lt;br /&gt;
In fact all three spots are not yellow. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be small. &lt;br /&gt;
In fact all three spots are large. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John in the village repairs shoes of all people in the village &lt;br /&gt;
who do not repair their own shoes. &lt;br /&gt;
Does John repair his own shoes?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John in the village shaves beards of all people in the village &lt;br /&gt;
who do not shave their beards. &lt;br /&gt;
Does John shave his own beard?&lt;br /&gt;
&lt;br /&gt;
OK&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 100 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
OK&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 100 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to east. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 80 km to east,&lt;br /&gt;
then 120 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 80 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 1 km to east,&lt;br /&gt;
then 100 km to north, then 2 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 10 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
You are a semantic parser to first order predicate logic. &lt;br /&gt;
Give a logical representation of the sentence &amp;quot;All dogs have a tail&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
???&lt;br /&gt;
&lt;br /&gt;
You are a semantic parser to first order predicate logic.&lt;br /&gt;
Examples: &lt;br /&gt;
&amp;quot;All dogs have a tail&amp;quot; -&amp;gt; All x (dog(x) =&amp;gt; Exists y (tail(y))).&lt;br /&gt;
&amp;quot;All animals have a head&amp;quot; -&amp;gt; All x (animal(x) =&amp;gt; Exists y (head(y))).&lt;br /&gt;
&amp;quot;All bears like honey&amp;quot; -&amp;gt; All x All y (animal(x) &amp;amp; honey(y) =&amp;gt; likes(x,y)).&lt;br /&gt;
&amp;quot;All birds are able to fly&amp;quot; -&amp;gt; All x (bird(x) =&amp;gt; able_to(x,fly)).&lt;br /&gt;
Give a logical representation of the sentence &amp;quot;All mice have a tail&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Details_of_the_KR_second_lab_in_2025&amp;diff=22037</id>
		<title>Details of the KR second lab in 2025</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Details_of_the_KR_second_lab_in_2025&amp;diff=22037"/>
		<updated>2025-03-10T10:42:02Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Katseta GPTd otsi/järeldamisülesande jaoks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mitu varianti LLMi katsetamine: low level (keerulisemad) kuni high-level (lihtsamad).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= LLMi ise õpetamine (mõõdukalt keeruline, kas windowsis saab, ei tea) =&lt;br /&gt;
&lt;br /&gt;
Linuxis ja Applel mõõdukalt keeruline, Windowsis ei tea, kas saab või ei.&lt;br /&gt;
&lt;br /&gt;
Karpathy nanogpt ([https://youtu.be/kCc8FmEb1nY?si=mDmodHRuQk5XFTVY video], [https://www.youtube.com/playlist?list=PLAqhIrjkxbuWI23v9cThsA9GvCAUhRvKZ videosari], [https://github.com/karpathy/nanoGPT repo]) õpetamine mõne teise korpuse pealt kui &lt;br /&gt;
shakespeare + eksperimenteerimine tekstijätkumise kvaliteediga:&lt;br /&gt;
mis töötab, mis ei. Üks variant on wikipedia tekstiformaat &lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz wikipedia täistekst]&lt;br /&gt;
ja [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz sama lemmatiseeritult]&lt;br /&gt;
&lt;br /&gt;
Eriti hea mõte oleks, kui korpuses on küsimus-vastuspaarid&lt;br /&gt;
mingi konkreetset tüüpi ülesande jaoks, a la lihtsate&lt;br /&gt;
lausete parsimine, aritmeetikatehted, valemite süntaksikontroll,&lt;br /&gt;
väga lihtsa tekstülesande teisendamine pythoni koodiks vms.&lt;br /&gt;
Küsimus-vastuspaare progega genereerida: teed N template ja&lt;br /&gt;
genereerid nendest templatedest!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alternatiiv:&#039;&#039;&#039; Võtta baasmudeliks GPT2 ja peenhäälestada (finetuning) see nanoGPT abil oma andmete abil.&lt;br /&gt;
nanoGPT võimaldab valida baasmudel nelja erineva suurusega GPT2 mudeli hulgast. Kõige väiksem on peenhäälestatav ka ilma GPU-ta arvutil (aega läheb muidugi tunde).&lt;br /&gt;
&lt;br /&gt;
= Berti mõne derivaadi finetunimine spetsiifilise ülesande jaoks =&lt;br /&gt;
&lt;br /&gt;
(keeruline, jällegi, pigem linuxis; sobivate õpetuste leidmine&lt;br /&gt;
ei pruugi olla lihtne)&lt;br /&gt;
&lt;br /&gt;
Vali sobiv Berti variant ja tekita näite-küsimusvastuspaarid&lt;br /&gt;
nagu eelmises ülesandes. &lt;br /&gt;
&lt;br /&gt;
Katseta finetunitud berti: millega ta selle ülesannete klassi&lt;br /&gt;
jaoks veel hakkama saab ja millega mitte eriti.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Väikese teadmusbaasi ise ehitamine LLMi abil =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Build a small knowledge base by asking LLM. What should the knowledge be about? &lt;br /&gt;
Think about something which would be useful to know for some planning or reasoning task, &lt;br /&gt;
like distances between cities, ways to travel from one place to another, features of cities/locations or features/properties of movies, actors, books etc.&lt;br /&gt;
The knowledge base should have some explainable point to it and a limited theme/subject area: you do not want to make it too massive.&lt;br /&gt;
&lt;br /&gt;
As a small example, here is an experimental knowledge base of [http://turing.cs.ttu.ee/~tanel.tammet/sizes_best.csv sizes of objects], built&lt;br /&gt;
by Tanel in a combined way from pre-existing knowledge and by additionally asking LLM. The llm-asking python code is [http://turing.cs.ttu.ee/~tanel.tammet/llmsize.py here] &lt;br /&gt;
and it requires a file &amp;quot;secrets.js&amp;quot; containing the GPT API key like this {&amp;quot;gpt_key&amp;quot;: &amp;quot;sk-wo...2e&amp;quot;} and an existing [http://turing.cs.ttu.ee/~tanel.tammet/sizes1.txt list of words] with their rough sizes. &lt;br /&gt;
&lt;br /&gt;
You may also want to use a large [http://turing.cs.ttu.ee/~tanel.tammet/important_words.txt word/concept list] built by Tanel in a rough order of importance / frequency of use, built by combining three sources:&lt;br /&gt;
is a word known to children, the frequency in English, the number of visits on Wikipedia. NB! This file is ca 370MB: you do not want to open it in a browser.&lt;br /&gt;
&lt;br /&gt;
= Multishot ülesannete katsetamine LLM-iga =&lt;br /&gt;
&lt;br /&gt;
== OpenAI GPT ==&lt;br /&gt;
https://openai.com/blog/openai-api&lt;br /&gt;
&lt;br /&gt;
ja [http://turing.cs.ttu.ee/~tanel.tammet/gptapi.tar.gz näitekood api lihtsamaks kasutamiseks]&lt;br /&gt;
&lt;br /&gt;
== Teised API võimalused ==&lt;br /&gt;
&lt;br /&gt;
Samad, mis esimeses ülesandes:&lt;br /&gt;
&lt;br /&gt;
* [https://mistral.ai/ mistral.ai] you can try API for free (150.00€/month limit), in exchange your API requests may be used to improve their services.&lt;br /&gt;
&lt;br /&gt;
* [https://together.ai together.ai] that allows you to use open source LLMs for a small fee. Two of their models are available for free: Llama-3.3-70B-Instruct-Turbo-Free and DeepSeek-R1-Distill-Llama-70B-free. They used to have 25$ credit for new users, but this might not be the case anymore.&lt;br /&gt;
&lt;br /&gt;
* [https://aistudio.google.com/ aistudio.google.com] Google AI Studio now also allows to create an API key (includes a free tier), that can be used to make request over Gemini API (see the documentation: https://ai.google.dev/gemini-api/docs) for more information.&lt;br /&gt;
&lt;br /&gt;
* [https://ollama.com/ ollama.com] makes it easy to run free models on local computer. Smaller models run even without GPU.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cheahjs/free-llm-api-resources List of additional resources that have free options]&lt;br /&gt;
&lt;br /&gt;
* [https://console.groq.com/ groqcloud] Mitmed avatud mudelid&lt;br /&gt;
&lt;br /&gt;
== Chat ==&lt;br /&gt;
&lt;br /&gt;
Lisaks ChatGPT-le on palju muid chati võimalusi, millest küll kõik ei toeta veel niinimetatud &#039;&#039;Thinking&#039;&#039; ehk &#039;&#039;Reasoning&#039;&#039; režiimi.&lt;br /&gt;
&lt;br /&gt;
* [https://chat.mistral.ai/chat Mistrali Le Chat]&lt;br /&gt;
* [https://claude.ai/ claude.ai]&lt;br /&gt;
* [https://chat.deepseek.com/ deepseek.com] &lt;br /&gt;
* [https://inference.cerebras.ai/ cerebras inference Deepseek ja Llama]&lt;br /&gt;
* [https://copilot.microsoft.com/ Microsoft copilot]]&lt;br /&gt;
* [https://grok.com/ grok.com]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mida võiks proovida ==&lt;br /&gt;
&lt;br /&gt;
* Võib katsetada Taneli näitepromptidega ja leida, millega hakkama saab ja millega mitte. Hea mõte on leida spetsiifilisem ülesanne ja proovida selle jaoks prompte (N-shot).&lt;br /&gt;
&lt;br /&gt;
* Teisenda LLMi abil loomuliku keele laused logictools-ile (või gkc-le) sobivaks sisendiks (kasuta oma esimeses ülesandes tehtud näiteid).&lt;br /&gt;
&lt;br /&gt;
= Katseta LLMi otsi/järeldamisülesande jaoks = &lt;br /&gt;
&lt;br /&gt;
Katseta nö tavalist LLMi ja LLMi &#039;&#039;Thinking&#039;&#039; ehk &#039;&#039;Reasoning&#039;&#039; režiimi (ei pea olema sama mudel).&lt;br /&gt;
&lt;br /&gt;
Leia keerukuse tase, kus ta enamasti ebaõnnestub. &lt;br /&gt;
&lt;br /&gt;
Kuidas teha ülesannet keerulisemaks:&lt;br /&gt;
* Rohkem võimalikke teid ja ummikuid.&lt;br /&gt;
* Kasutada tundmatuid sõnu a la blabla.&lt;br /&gt;
* Lisada ballastteksti.&lt;br /&gt;
&lt;br /&gt;
Kõige parem on katsetada APIga, aga saab ka ilma. Vaata erinevaid võimalusi eelmise ülesande kirjeldusest.&lt;br /&gt;
&lt;br /&gt;
Järgnevad näited on eelmise aasta praksist https://copilot.microsoft.com/ peal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NB!&amp;lt;/b&amp;gt; Pane tähele, et gpt vastused ei ole stabiilsed: ta võib mingi hetk vastata õieti/valesti, ja paar tundi hiljem teistpidi!&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.  &lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z. &lt;br /&gt;
There is a road from x1 to x2. &lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to x4. &lt;br /&gt;
Is there a road from x4 to x1? &lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
adsas dppdo akka assas .&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
KKKK! Asasas!&lt;br /&gt;
There is a bloo from x1 to x2.&lt;br /&gt;
sdad 103033. 223! sdsad!&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
as sasd aasd asd asd.&lt;br /&gt;
There is a friend from x2 to x4.&lt;br /&gt;
asas asas as. sdoisad, 111.&lt;br /&gt;
Is there a road from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
There is a road from x1 to x2.&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to x4.&lt;br /&gt;
There is a road from x2 to x9.&lt;br /&gt;
There is a road from x4 to x7.&lt;br /&gt;
There is a road from x6 to x10.&lt;br /&gt;
There is a road from x10 to x11.&lt;br /&gt;
There is a road from x11 to x8.&lt;br /&gt;
Is there a road from x8 to x1?&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
There is a road from x1 to x2.&lt;br /&gt;
x1 is a bad place.&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to bath.&lt;br /&gt;
There is a road from x2 to x4.&lt;br /&gt;
x2 is a nice place.&lt;br /&gt;
There is a road from x3 to somwhere.&lt;br /&gt;
John is nowhere.&lt;br /&gt;
There is no road to hell.&lt;br /&gt;
Is there a road from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If there is a blabla from X to Y, then there is a blabla from Y to X.&lt;br /&gt;
If there is a blabla from X to Y and there is a blabla from Y to Z, then there is a blabla from X to Z.&lt;br /&gt;
There is a blabla from x1 to x2.&lt;br /&gt;
x1 is a bad place.&lt;br /&gt;
There is a blabla from x2 to x3.&lt;br /&gt;
There is a blabla from x2 to bath.&lt;br /&gt;
There is a blabla from x2 to x4.&lt;br /&gt;
x2 is a nice place.&lt;br /&gt;
There is a blabla from x3 to somwhere.&lt;br /&gt;
John is nowhere.&lt;br /&gt;
There is no blabla to hell.&lt;br /&gt;
Is there a blabla from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
------&lt;br /&gt;
&lt;br /&gt;
Works OK:&lt;br /&gt;
&lt;br /&gt;
John had three apples. Mike has two pears.&lt;br /&gt;
Pears and apples are fruits. &lt;br /&gt;
Mike gives all his fruits to John.&lt;br /&gt;
How many fruits does John have?&lt;br /&gt;
&lt;br /&gt;
Does not work ok:&lt;br /&gt;
&lt;br /&gt;
John had three apples. Mike has two pears.&lt;br /&gt;
Pears and apples are fruits. &lt;br /&gt;
Mike eats two pears.&lt;br /&gt;
Mike gives all his fruits to John.&lt;br /&gt;
John eats one apple.&lt;br /&gt;
How many fruits does John have?&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Ei ole OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a white or black spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be white. &lt;br /&gt;
In fact all three spots are white. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
&lt;br /&gt;
Kui see lisada, on OK:&lt;br /&gt;
&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be yellow. &lt;br /&gt;
In fact all three spots are yellow. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be yellow. &lt;br /&gt;
In fact all three spots are not yellow. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be small. &lt;br /&gt;
In fact all three spots are large. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John in the village repairs shoes of all people in the village &lt;br /&gt;
who do not repair their own shoes. &lt;br /&gt;
Does John repair his own shoes?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John in the village shaves beards of all people in the village &lt;br /&gt;
who do not shave their beards. &lt;br /&gt;
Does John shave his own beard?&lt;br /&gt;
&lt;br /&gt;
OK&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 100 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
OK&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 100 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to east. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 80 km to east,&lt;br /&gt;
then 120 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 80 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 1 km to east,&lt;br /&gt;
then 100 km to north, then 2 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 10 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
You are a semantic parser to first order predicate logic. &lt;br /&gt;
Give a logical representation of the sentence &amp;quot;All dogs have a tail&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
???&lt;br /&gt;
&lt;br /&gt;
You are a semantic parser to first order predicate logic.&lt;br /&gt;
Examples: &lt;br /&gt;
&amp;quot;All dogs have a tail&amp;quot; -&amp;gt; All x (dog(x) =&amp;gt; Exists y (tail(y))).&lt;br /&gt;
&amp;quot;All animals have a head&amp;quot; -&amp;gt; All x (animal(x) =&amp;gt; Exists y (head(y))).&lt;br /&gt;
&amp;quot;All bears like honey&amp;quot; -&amp;gt; All x All y (animal(x) &amp;amp; honey(y) =&amp;gt; likes(x,y)).&lt;br /&gt;
&amp;quot;All birds are able to fly&amp;quot; -&amp;gt; All x (bird(x) =&amp;gt; able_to(x,fly)).&lt;br /&gt;
Give a logical representation of the sentence &amp;quot;All mice have a tail&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Details_of_the_KR_second_lab_in_2025&amp;diff=22036</id>
		<title>Details of the KR second lab in 2025</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Details_of_the_KR_second_lab_in_2025&amp;diff=22036"/>
		<updated>2025-03-10T10:17:00Z</updated>

		<summary type="html">&lt;p&gt;Riina: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mitu varianti LLMi katsetamine: low level (keerulisemad) kuni high-level (lihtsamad).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= LLMi ise õpetamine (mõõdukalt keeruline, kas windowsis saab, ei tea) =&lt;br /&gt;
&lt;br /&gt;
Linuxis ja Applel mõõdukalt keeruline, Windowsis ei tea, kas saab või ei.&lt;br /&gt;
&lt;br /&gt;
Karpathy nanogpt ([https://youtu.be/kCc8FmEb1nY?si=mDmodHRuQk5XFTVY video], [https://www.youtube.com/playlist?list=PLAqhIrjkxbuWI23v9cThsA9GvCAUhRvKZ videosari], [https://github.com/karpathy/nanoGPT repo]) õpetamine mõne teise korpuse pealt kui &lt;br /&gt;
shakespeare + eksperimenteerimine tekstijätkumise kvaliteediga:&lt;br /&gt;
mis töötab, mis ei. Üks variant on wikipedia tekstiformaat &lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz wikipedia täistekst]&lt;br /&gt;
ja [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz sama lemmatiseeritult]&lt;br /&gt;
&lt;br /&gt;
Eriti hea mõte oleks, kui korpuses on küsimus-vastuspaarid&lt;br /&gt;
mingi konkreetset tüüpi ülesande jaoks, a la lihtsate&lt;br /&gt;
lausete parsimine, aritmeetikatehted, valemite süntaksikontroll,&lt;br /&gt;
väga lihtsa tekstülesande teisendamine pythoni koodiks vms.&lt;br /&gt;
Küsimus-vastuspaare progega genereerida: teed N template ja&lt;br /&gt;
genereerid nendest templatedest!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alternatiiv:&#039;&#039;&#039; Võtta baasmudeliks GPT2 ja peenhäälestada (finetuning) see nanoGPT abil oma andmete abil.&lt;br /&gt;
nanoGPT võimaldab valida baasmudel nelja erineva suurusega GPT2 mudeli hulgast. Kõige väiksem on peenhäälestatav ka ilma GPU-ta arvutil (aega läheb muidugi tunde).&lt;br /&gt;
&lt;br /&gt;
= Berti mõne derivaadi finetunimine spetsiifilise ülesande jaoks =&lt;br /&gt;
&lt;br /&gt;
(keeruline, jällegi, pigem linuxis; sobivate õpetuste leidmine&lt;br /&gt;
ei pruugi olla lihtne)&lt;br /&gt;
&lt;br /&gt;
Vali sobiv Berti variant ja tekita näite-küsimusvastuspaarid&lt;br /&gt;
nagu eelmises ülesandes. &lt;br /&gt;
&lt;br /&gt;
Katseta finetunitud berti: millega ta selle ülesannete klassi&lt;br /&gt;
jaoks veel hakkama saab ja millega mitte eriti.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Väikese teadmusbaasi ise ehitamine LLMi abil =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Build a small knowledge base by asking LLM. What should the knowledge be about? &lt;br /&gt;
Think about something which would be useful to know for some planning or reasoning task, &lt;br /&gt;
like distances between cities, ways to travel from one place to another, features of cities/locations or features/properties of movies, actors, books etc.&lt;br /&gt;
The knowledge base should have some explainable point to it and a limited theme/subject area: you do not want to make it too massive.&lt;br /&gt;
&lt;br /&gt;
As a small example, here is an experimental knowledge base of [http://turing.cs.ttu.ee/~tanel.tammet/sizes_best.csv sizes of objects], built&lt;br /&gt;
by Tanel in a combined way from pre-existing knowledge and by additionally asking LLM. The llm-asking python code is [http://turing.cs.ttu.ee/~tanel.tammet/llmsize.py here] &lt;br /&gt;
and it requires a file &amp;quot;secrets.js&amp;quot; containing the GPT API key like this {&amp;quot;gpt_key&amp;quot;: &amp;quot;sk-wo...2e&amp;quot;} and an existing [http://turing.cs.ttu.ee/~tanel.tammet/sizes1.txt list of words] with their rough sizes. &lt;br /&gt;
&lt;br /&gt;
You may also want to use a large [http://turing.cs.ttu.ee/~tanel.tammet/important_words.txt word/concept list] built by Tanel in a rough order of importance / frequency of use, built by combining three sources:&lt;br /&gt;
is a word known to children, the frequency in English, the number of visits on Wikipedia. NB! This file is ca 370MB: you do not want to open it in a browser.&lt;br /&gt;
&lt;br /&gt;
= Multishot ülesannete katsetamine LLM-iga =&lt;br /&gt;
&lt;br /&gt;
== OpenAI GPT ==&lt;br /&gt;
https://openai.com/blog/openai-api&lt;br /&gt;
&lt;br /&gt;
ja [http://turing.cs.ttu.ee/~tanel.tammet/gptapi.tar.gz näitekood api lihtsamaks kasutamiseks]&lt;br /&gt;
&lt;br /&gt;
== Teised API võimalused ==&lt;br /&gt;
&lt;br /&gt;
Samad, mis esimeses ülesandes:&lt;br /&gt;
&lt;br /&gt;
* [https://mistral.ai/ mistral.ai] you can try API for free (150.00€/month limit), in exchange your API requests may be used to improve their services.&lt;br /&gt;
&lt;br /&gt;
* [https://together.ai together.ai] that allows you to use open source LLMs for a small fee. Two of their models are available for free: Llama-3.3-70B-Instruct-Turbo-Free and DeepSeek-R1-Distill-Llama-70B-free. They used to have 25$ credit for new users, but this might not be the case anymore.&lt;br /&gt;
&lt;br /&gt;
* [https://aistudio.google.com/ aistudio.google.com] Google AI Studio now also allows to create an API key (includes a free tier), that can be used to make request over Gemini API (see the documentation: https://ai.google.dev/gemini-api/docs) for more information.&lt;br /&gt;
&lt;br /&gt;
* [https://ollama.com/ ollama.com] makes it easy to run free models on local computer. Smaller models run even without GPU.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cheahjs/free-llm-api-resources List of additional resources that have free options]&lt;br /&gt;
&lt;br /&gt;
* [https://console.groq.com/ groqcloud] Mitmed avatud mudelid&lt;br /&gt;
&lt;br /&gt;
== Chat ==&lt;br /&gt;
&lt;br /&gt;
Lisaks ChatGPT-le on palju muid chati võimalusi, millest küll kõik ei toeta veel niinimetatud &#039;&#039;Thinking&#039;&#039; ehk &#039;&#039;Reasoning&#039;&#039; režiimi.&lt;br /&gt;
&lt;br /&gt;
* [https://chat.mistral.ai/chat Mistrali Le Chat]&lt;br /&gt;
* [https://claude.ai/ claude.ai]&lt;br /&gt;
* [https://chat.deepseek.com/ deepseek.com] &lt;br /&gt;
* [https://inference.cerebras.ai/ cerebras inference Deepseek ja Llama]&lt;br /&gt;
* [https://copilot.microsoft.com/ Microsoft copilot]]&lt;br /&gt;
* [https://grok.com/ grok.com]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mida võiks proovida ==&lt;br /&gt;
&lt;br /&gt;
* Võib katsetada Taneli näitepromptidega ja leida, millega hakkama saab ja millega mitte. Hea mõte on leida spetsiifilisem ülesanne ja proovida selle jaoks prompte (N-shot).&lt;br /&gt;
&lt;br /&gt;
* Teisenda LLMi abil loomuliku keele laused logictools-ile (või gkc-le) sobivaks sisendiks (kasuta oma esimeses ülesandes tehtud näiteid).&lt;br /&gt;
&lt;br /&gt;
= Katseta GPTd otsi/järeldamisülesande jaoks = &lt;br /&gt;
&lt;br /&gt;
Leia keerukuse tase, kus ta enamasti ebaõnnestub.&lt;br /&gt;
&lt;br /&gt;
Kuidas teha ülesannet keerulisemaks:&lt;br /&gt;
* Rohkem võimalikke teid ja ummikuid.&lt;br /&gt;
* Kasutada tundmatuid sõnu a la blabla.&lt;br /&gt;
* Lisada ballastteksti.&lt;br /&gt;
&lt;br /&gt;
Kõige parem on katsetada APIga, aga saab ka&lt;br /&gt;
* https://copilot.microsoft.com/ (vbl gpt4?)&lt;br /&gt;
* https://platform.openai.com/playground&lt;br /&gt;
* https://chat.openai.com/&lt;br /&gt;
&lt;br /&gt;
Järgnevad näiteid praksist https://copilot.microsoft.com/ peal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NB!&amp;lt;/b&amp;gt; Pane tähele, et gpt vastused ei ole stabiilsed: ta võib mingi hetk vastata õieti/valesti, ja paar tundi hiljem teistpidi!&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.  &lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z. &lt;br /&gt;
There is a road from x1 to x2. &lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to x4. &lt;br /&gt;
Is there a road from x4 to x1? &lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
adsas dppdo akka assas .&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
KKKK! Asasas!&lt;br /&gt;
There is a bloo from x1 to x2.&lt;br /&gt;
sdad 103033. 223! sdsad!&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
as sasd aasd asd asd.&lt;br /&gt;
There is a friend from x2 to x4.&lt;br /&gt;
asas asas as. sdoisad, 111.&lt;br /&gt;
Is there a road from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
There is a road from x1 to x2.&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to x4.&lt;br /&gt;
There is a road from x2 to x9.&lt;br /&gt;
There is a road from x4 to x7.&lt;br /&gt;
There is a road from x6 to x10.&lt;br /&gt;
There is a road from x10 to x11.&lt;br /&gt;
There is a road from x11 to x8.&lt;br /&gt;
Is there a road from x8 to x1?&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
There is a road from x1 to x2.&lt;br /&gt;
x1 is a bad place.&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to bath.&lt;br /&gt;
There is a road from x2 to x4.&lt;br /&gt;
x2 is a nice place.&lt;br /&gt;
There is a road from x3 to somwhere.&lt;br /&gt;
John is nowhere.&lt;br /&gt;
There is no road to hell.&lt;br /&gt;
Is there a road from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If there is a blabla from X to Y, then there is a blabla from Y to X.&lt;br /&gt;
If there is a blabla from X to Y and there is a blabla from Y to Z, then there is a blabla from X to Z.&lt;br /&gt;
There is a blabla from x1 to x2.&lt;br /&gt;
x1 is a bad place.&lt;br /&gt;
There is a blabla from x2 to x3.&lt;br /&gt;
There is a blabla from x2 to bath.&lt;br /&gt;
There is a blabla from x2 to x4.&lt;br /&gt;
x2 is a nice place.&lt;br /&gt;
There is a blabla from x3 to somwhere.&lt;br /&gt;
John is nowhere.&lt;br /&gt;
There is no blabla to hell.&lt;br /&gt;
Is there a blabla from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
------&lt;br /&gt;
&lt;br /&gt;
Works OK:&lt;br /&gt;
&lt;br /&gt;
John had three apples. Mike has two pears.&lt;br /&gt;
Pears and apples are fruits. &lt;br /&gt;
Mike gives all his fruits to John.&lt;br /&gt;
How many fruits does John have?&lt;br /&gt;
&lt;br /&gt;
Does not work ok:&lt;br /&gt;
&lt;br /&gt;
John had three apples. Mike has two pears.&lt;br /&gt;
Pears and apples are fruits. &lt;br /&gt;
Mike eats two pears.&lt;br /&gt;
Mike gives all his fruits to John.&lt;br /&gt;
John eats one apple.&lt;br /&gt;
How many fruits does John have?&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Ei ole OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a white or black spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be white. &lt;br /&gt;
In fact all three spots are white. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
&lt;br /&gt;
Kui see lisada, on OK:&lt;br /&gt;
&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be yellow. &lt;br /&gt;
In fact all three spots are yellow. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be yellow. &lt;br /&gt;
In fact all three spots are not yellow. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be small. &lt;br /&gt;
In fact all three spots are large. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John in the village repairs shoes of all people in the village &lt;br /&gt;
who do not repair their own shoes. &lt;br /&gt;
Does John repair his own shoes?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John in the village shaves beards of all people in the village &lt;br /&gt;
who do not shave their beards. &lt;br /&gt;
Does John shave his own beard?&lt;br /&gt;
&lt;br /&gt;
OK&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 100 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
OK&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 100 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to east. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 80 km to east,&lt;br /&gt;
then 120 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 80 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 1 km to east,&lt;br /&gt;
then 100 km to north, then 2 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 10 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
You are a semantic parser to first order predicate logic. &lt;br /&gt;
Give a logical representation of the sentence &amp;quot;All dogs have a tail&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
???&lt;br /&gt;
&lt;br /&gt;
You are a semantic parser to first order predicate logic.&lt;br /&gt;
Examples: &lt;br /&gt;
&amp;quot;All dogs have a tail&amp;quot; -&amp;gt; All x (dog(x) =&amp;gt; Exists y (tail(y))).&lt;br /&gt;
&amp;quot;All animals have a head&amp;quot; -&amp;gt; All x (animal(x) =&amp;gt; Exists y (head(y))).&lt;br /&gt;
&amp;quot;All bears like honey&amp;quot; -&amp;gt; All x All y (animal(x) &amp;amp; honey(y) =&amp;gt; likes(x,y)).&lt;br /&gt;
&amp;quot;All birds are able to fly&amp;quot; -&amp;gt; All x (bird(x) =&amp;gt; able_to(x,fly)).&lt;br /&gt;
Give a logical representation of the sentence &amp;quot;All mice have a tail&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Details_of_the_KR_second_lab_in_2025&amp;diff=22035</id>
		<title>Details of the KR second lab in 2025</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Details_of_the_KR_second_lab_in_2025&amp;diff=22035"/>
		<updated>2025-03-10T10:16:36Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* OpenAi GPT mõne versiooniga multishot ülesannete katsetamine */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mitu varianti LLMi katsetamine: low level (keerulisemad) kuni high-level (lihtsamad).&lt;br /&gt;
&lt;br /&gt;
NB! Uuri ka https://www.together.ai/pricing mis paistab olema väga odav.&lt;br /&gt;
&lt;br /&gt;
= LLMi ise õpetamine (mõõdukalt keeruline, kas windowsis saab, ei tea) =&lt;br /&gt;
&lt;br /&gt;
Linuxis ja Applel mõõdukalt keeruline, Windowsis ei tea, kas saab või ei.&lt;br /&gt;
&lt;br /&gt;
Karpathy nanogpt ([https://youtu.be/kCc8FmEb1nY?si=mDmodHRuQk5XFTVY video], [https://www.youtube.com/playlist?list=PLAqhIrjkxbuWI23v9cThsA9GvCAUhRvKZ videosari], [https://github.com/karpathy/nanoGPT repo]) õpetamine mõne teise korpuse pealt kui &lt;br /&gt;
shakespeare + eksperimenteerimine tekstijätkumise kvaliteediga:&lt;br /&gt;
mis töötab, mis ei. Üks variant on wikipedia tekstiformaat &lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz wikipedia täistekst]&lt;br /&gt;
ja [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz sama lemmatiseeritult]&lt;br /&gt;
&lt;br /&gt;
Eriti hea mõte oleks, kui korpuses on küsimus-vastuspaarid&lt;br /&gt;
mingi konkreetset tüüpi ülesande jaoks, a la lihtsate&lt;br /&gt;
lausete parsimine, aritmeetikatehted, valemite süntaksikontroll,&lt;br /&gt;
väga lihtsa tekstülesande teisendamine pythoni koodiks vms.&lt;br /&gt;
Küsimus-vastuspaare progega genereerida: teed N template ja&lt;br /&gt;
genereerid nendest templatedest!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alternatiiv:&#039;&#039;&#039; Võtta baasmudeliks GPT2 ja peenhäälestada (finetuning) see nanoGPT abil oma andmete abil.&lt;br /&gt;
nanoGPT võimaldab valida baasmudel nelja erineva suurusega GPT2 mudeli hulgast. Kõige väiksem on peenhäälestatav ka ilma GPU-ta arvutil (aega läheb muidugi tunde).&lt;br /&gt;
&lt;br /&gt;
= Berti mõne derivaadi finetunimine spetsiifilise ülesande jaoks =&lt;br /&gt;
&lt;br /&gt;
(keeruline, jällegi, pigem linuxis; sobivate õpetuste leidmine&lt;br /&gt;
ei pruugi olla lihtne)&lt;br /&gt;
&lt;br /&gt;
Vali sobiv Berti variant ja tekita näite-küsimusvastuspaarid&lt;br /&gt;
nagu eelmises ülesandes. &lt;br /&gt;
&lt;br /&gt;
Katseta finetunitud berti: millega ta selle ülesannete klassi&lt;br /&gt;
jaoks veel hakkama saab ja millega mitte eriti.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Väikese teadmusbaasi ise ehitamine LLMi abil =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Build a small knowledge base by asking LLM. What should the knowledge be about? &lt;br /&gt;
Think about something which would be useful to know for some planning or reasoning task, &lt;br /&gt;
like distances between cities, ways to travel from one place to another, features of cities/locations or features/properties of movies, actors, books etc.&lt;br /&gt;
The knowledge base should have some explainable point to it and a limited theme/subject area: you do not want to make it too massive.&lt;br /&gt;
&lt;br /&gt;
As a small example, here is an experimental knowledge base of [http://turing.cs.ttu.ee/~tanel.tammet/sizes_best.csv sizes of objects], built&lt;br /&gt;
by Tanel in a combined way from pre-existing knowledge and by additionally asking LLM. The llm-asking python code is [http://turing.cs.ttu.ee/~tanel.tammet/llmsize.py here] &lt;br /&gt;
and it requires a file &amp;quot;secrets.js&amp;quot; containing the GPT API key like this {&amp;quot;gpt_key&amp;quot;: &amp;quot;sk-wo...2e&amp;quot;} and an existing [http://turing.cs.ttu.ee/~tanel.tammet/sizes1.txt list of words] with their rough sizes. &lt;br /&gt;
&lt;br /&gt;
You may also want to use a large [http://turing.cs.ttu.ee/~tanel.tammet/important_words.txt word/concept list] built by Tanel in a rough order of importance / frequency of use, built by combining three sources:&lt;br /&gt;
is a word known to children, the frequency in English, the number of visits on Wikipedia. NB! This file is ca 370MB: you do not want to open it in a browser.&lt;br /&gt;
&lt;br /&gt;
= Multishot ülesannete katsetamine LLM-iga =&lt;br /&gt;
&lt;br /&gt;
== OpenAI GPT ==&lt;br /&gt;
https://openai.com/blog/openai-api&lt;br /&gt;
&lt;br /&gt;
ja [http://turing.cs.ttu.ee/~tanel.tammet/gptapi.tar.gz näitekood api lihtsamaks kasutamiseks]&lt;br /&gt;
&lt;br /&gt;
== Teised API võimalused ==&lt;br /&gt;
&lt;br /&gt;
Samad, mis esimeses ülesandes:&lt;br /&gt;
&lt;br /&gt;
* [https://mistral.ai/ mistral.ai] you can try API for free (150.00€/month limit), in exchange your API requests may be used to improve their services.&lt;br /&gt;
&lt;br /&gt;
* [https://together.ai together.ai] that allows you to use open source LLMs for a small fee. Two of their models are available for free: Llama-3.3-70B-Instruct-Turbo-Free and DeepSeek-R1-Distill-Llama-70B-free. They used to have 25$ credit for new users, but this might not be the case anymore.&lt;br /&gt;
&lt;br /&gt;
* [https://aistudio.google.com/ aistudio.google.com] Google AI Studio now also allows to create an API key (includes a free tier), that can be used to make request over Gemini API (see the documentation: https://ai.google.dev/gemini-api/docs) for more information.&lt;br /&gt;
&lt;br /&gt;
* [https://ollama.com/ ollama.com] makes it easy to run free models on local computer. Smaller models run even without GPU.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cheahjs/free-llm-api-resources List of additional resources that have free options]&lt;br /&gt;
&lt;br /&gt;
* [https://console.groq.com/ groqcloud] Mitmed avatud mudelid&lt;br /&gt;
&lt;br /&gt;
== Chat ==&lt;br /&gt;
&lt;br /&gt;
Lisaks ChatGPT-le on palju muid chati võimalusi, millest küll kõik ei toeta veel niinimetatud &#039;&#039;Thinking&#039;&#039; ehk &#039;&#039;Reasoning&#039;&#039; režiimi.&lt;br /&gt;
&lt;br /&gt;
* [https://chat.mistral.ai/chat Mistrali Le Chat]&lt;br /&gt;
* [https://claude.ai/ claude.ai]&lt;br /&gt;
* [https://chat.deepseek.com/ deepseek.com] &lt;br /&gt;
* [https://inference.cerebras.ai/ cerebras inference Deepseek ja Llama]&lt;br /&gt;
* [https://copilot.microsoft.com/ Microsoft copilot]]&lt;br /&gt;
* [https://grok.com/ grok.com]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mida võiks proovida ==&lt;br /&gt;
&lt;br /&gt;
* Võib katsetada Taneli näitepromptidega ja leida, millega hakkama saab ja millega mitte. Hea mõte on leida spetsiifilisem ülesanne ja proovida selle jaoks prompte (N-shot).&lt;br /&gt;
&lt;br /&gt;
* Teisenda LLMi abil loomuliku keele laused logictools-ile (või gkc-le) sobivaks sisendiks (kasuta oma esimeses ülesandes tehtud näiteid).&lt;br /&gt;
&lt;br /&gt;
= Katseta GPTd otsi/järeldamisülesande jaoks = &lt;br /&gt;
&lt;br /&gt;
Leia keerukuse tase, kus ta enamasti ebaõnnestub.&lt;br /&gt;
&lt;br /&gt;
Kuidas teha ülesannet keerulisemaks:&lt;br /&gt;
* Rohkem võimalikke teid ja ummikuid.&lt;br /&gt;
* Kasutada tundmatuid sõnu a la blabla.&lt;br /&gt;
* Lisada ballastteksti.&lt;br /&gt;
&lt;br /&gt;
Kõige parem on katsetada APIga, aga saab ka&lt;br /&gt;
* https://copilot.microsoft.com/ (vbl gpt4?)&lt;br /&gt;
* https://platform.openai.com/playground&lt;br /&gt;
* https://chat.openai.com/&lt;br /&gt;
&lt;br /&gt;
Järgnevad näiteid praksist https://copilot.microsoft.com/ peal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NB!&amp;lt;/b&amp;gt; Pane tähele, et gpt vastused ei ole stabiilsed: ta võib mingi hetk vastata õieti/valesti, ja paar tundi hiljem teistpidi!&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.  &lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z. &lt;br /&gt;
There is a road from x1 to x2. &lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to x4. &lt;br /&gt;
Is there a road from x4 to x1? &lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
adsas dppdo akka assas .&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
KKKK! Asasas!&lt;br /&gt;
There is a bloo from x1 to x2.&lt;br /&gt;
sdad 103033. 223! sdsad!&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
as sasd aasd asd asd.&lt;br /&gt;
There is a friend from x2 to x4.&lt;br /&gt;
asas asas as. sdoisad, 111.&lt;br /&gt;
Is there a road from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
There is a road from x1 to x2.&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to x4.&lt;br /&gt;
There is a road from x2 to x9.&lt;br /&gt;
There is a road from x4 to x7.&lt;br /&gt;
There is a road from x6 to x10.&lt;br /&gt;
There is a road from x10 to x11.&lt;br /&gt;
There is a road from x11 to x8.&lt;br /&gt;
Is there a road from x8 to x1?&lt;br /&gt;
&lt;br /&gt;
If there is a road from X to Y, then there is a road from Y to X.&lt;br /&gt;
If there is a road from X to Y and there is a road from Y to Z, then there is a road from X to Z.&lt;br /&gt;
There is a road from x1 to x2.&lt;br /&gt;
x1 is a bad place.&lt;br /&gt;
There is a road from x2 to x3.&lt;br /&gt;
There is a road from x2 to bath.&lt;br /&gt;
There is a road from x2 to x4.&lt;br /&gt;
x2 is a nice place.&lt;br /&gt;
There is a road from x3 to somwhere.&lt;br /&gt;
John is nowhere.&lt;br /&gt;
There is no road to hell.&lt;br /&gt;
Is there a road from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If there is a blabla from X to Y, then there is a blabla from Y to X.&lt;br /&gt;
If there is a blabla from X to Y and there is a blabla from Y to Z, then there is a blabla from X to Z.&lt;br /&gt;
There is a blabla from x1 to x2.&lt;br /&gt;
x1 is a bad place.&lt;br /&gt;
There is a blabla from x2 to x3.&lt;br /&gt;
There is a blabla from x2 to bath.&lt;br /&gt;
There is a blabla from x2 to x4.&lt;br /&gt;
x2 is a nice place.&lt;br /&gt;
There is a blabla from x3 to somwhere.&lt;br /&gt;
John is nowhere.&lt;br /&gt;
There is no blabla to hell.&lt;br /&gt;
Is there a blabla from x4 to x1?&lt;br /&gt;
&lt;br /&gt;
------&lt;br /&gt;
&lt;br /&gt;
Works OK:&lt;br /&gt;
&lt;br /&gt;
John had three apples. Mike has two pears.&lt;br /&gt;
Pears and apples are fruits. &lt;br /&gt;
Mike gives all his fruits to John.&lt;br /&gt;
How many fruits does John have?&lt;br /&gt;
&lt;br /&gt;
Does not work ok:&lt;br /&gt;
&lt;br /&gt;
John had three apples. Mike has two pears.&lt;br /&gt;
Pears and apples are fruits. &lt;br /&gt;
Mike eats two pears.&lt;br /&gt;
Mike gives all his fruits to John.&lt;br /&gt;
John eats one apple.&lt;br /&gt;
How many fruits does John have?&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Ei ole OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a white or black spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be white. &lt;br /&gt;
In fact all three spots are white. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
&lt;br /&gt;
Kui see lisada, on OK:&lt;br /&gt;
&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be yellow. &lt;br /&gt;
In fact all three spots are yellow. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be yellow. &lt;br /&gt;
In fact all three spots are not yellow. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A certain king wishes to test his three wise men. &lt;br /&gt;
He arranges them in a circle so that they can &lt;br /&gt;
see and hear each other and tells them that &lt;br /&gt;
will put a yellow or red spot on each of their &lt;br /&gt;
foreheads but that at least one spot will be small. &lt;br /&gt;
In fact all three spots are large. He then repeatedly asks them,&lt;br /&gt;
``Do you know the color of your spot?&#039;&#039; What do they answer?&lt;br /&gt;
He then repeatedly asks them, ``Do you know the color of your spot?&#039;&#039; &lt;br /&gt;
Then the king asks again two times. What do they answer in the end?&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John in the village repairs shoes of all people in the village &lt;br /&gt;
who do not repair their own shoes. &lt;br /&gt;
Does John repair his own shoes?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John in the village shaves beards of all people in the village &lt;br /&gt;
who do not shave their beards. &lt;br /&gt;
Does John shave his own beard?&lt;br /&gt;
&lt;br /&gt;
OK&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 100 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
OK&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 100 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to east. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 80 km to east,&lt;br /&gt;
then 120 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 80 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 1 km to east,&lt;br /&gt;
then 100 km to north, then 2 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
A man called John walks 100 km to south, then 10 km to east,&lt;br /&gt;
then 100 km to north, then 100 km to west. Does John&lt;br /&gt;
arrive to the same place he started?&lt;br /&gt;
&lt;br /&gt;
Not OK:&lt;br /&gt;
&lt;br /&gt;
You are a semantic parser to first order predicate logic. &lt;br /&gt;
Give a logical representation of the sentence &amp;quot;All dogs have a tail&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
???&lt;br /&gt;
&lt;br /&gt;
You are a semantic parser to first order predicate logic.&lt;br /&gt;
Examples: &lt;br /&gt;
&amp;quot;All dogs have a tail&amp;quot; -&amp;gt; All x (dog(x) =&amp;gt; Exists y (tail(y))).&lt;br /&gt;
&amp;quot;All animals have a head&amp;quot; -&amp;gt; All x (animal(x) =&amp;gt; Exists y (head(y))).&lt;br /&gt;
&amp;quot;All bears like honey&amp;quot; -&amp;gt; All x All y (animal(x) &amp;amp; honey(y) =&amp;gt; likes(x,y)).&lt;br /&gt;
&amp;quot;All birds are able to fly&amp;quot; -&amp;gt; All x (bird(x) =&amp;gt; able_to(x,fly)).&lt;br /&gt;
Give a logical representation of the sentence &amp;quot;All mice have a tail&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22015</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=22015"/>
		<updated>2025-02-26T16:32:46Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Practical work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2024|2024]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt; about next week, 25. February =&lt;br /&gt;
&lt;br /&gt;
The 25. February lecture will be a recording from 2024 pluss self-study reading and experiments only, not in the lecture room: please see the 25. Feb chapter below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Tuesdays 14:00-15:30 room SOC 312/313 (313 weeks 1,3,5,...; 312 weeks 2,4,6,...)&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Wednesdays 12:00-13:30 room U06A-204.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3AmRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81%40thread.tacv2/conversations?groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams] of the course. The code for joining is &lt;br /&gt;
y0bd8e5.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566436916?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566436916&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566436916 teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566518846?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566518846&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566518846 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam, while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials will also come up, but less and/or in a simpler form. The markings will be changed as the course progresses, i.e. the future ones will not necessarily persist!&lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. &lt;br /&gt;
&lt;br /&gt;
= The first weekly task =&lt;br /&gt;
&lt;br /&gt;
Ülesanne on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 25. veebruar.&lt;br /&gt;
&lt;br /&gt;
Konkreetselt tee järgmist:&lt;br /&gt;
* Eksperimenteeri veidi [http://logictools.org logictools.org] &amp;quot;simple examples&amp;quot; valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest. &lt;br /&gt;
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda). &lt;br /&gt;
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga &amp;quot;SQL join as logical rule&amp;quot;, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu &amp;quot;answers&amp;quot; näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka &amp;quot;multiple answers&amp;quot; näidet.&lt;br /&gt;
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga (riina.maigre at taltech.ee ja cc tanel.tammet at taltech.ee). Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus): kirjuta aadressile riina.maigre at taltech.ee või tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna &amp;quot;formaliseerimine&amp;quot;, et kirja kergesti üles leiaks.&lt;br /&gt;
&lt;br /&gt;
Soovitused:&lt;br /&gt;
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).&lt;br /&gt;
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.&lt;br /&gt;
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis &amp;quot;arithmetic&amp;quot; näidet.&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
NB! The details of the second and third labs are currently from 2024 and will be updated.&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2025 homework part 1|2025 task for the first lab]] is about handling and understanding triplet stores, meaning of rdf types/properties/etc and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change.&lt;br /&gt;
&lt;br /&gt;
Deadline: 5. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
See [[Details of the KR second lab in 2025]]. This is not updated yet!&lt;br /&gt;
&lt;br /&gt;
Deadline: 9. April&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
These are also not updated yet!&lt;br /&gt;
&lt;br /&gt;
* [[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
* [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]]&lt;br /&gt;
&lt;br /&gt;
Deadline: 14. May.&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin.  [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) [https://web.stanford.edu/~jurafsky/slp3/ here the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/F.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
* [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2024 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 4. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2025.pdf|teadmised_intro2025.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel], [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel],&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 11. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl: 18. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
[[Rdf example developed during lecture]]&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: 25. February ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;NB!&amp;lt;/font&amp;gt;This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:&lt;br /&gt;
&lt;br /&gt;
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: looking into main large knowledge bases: 4. March  ===&lt;br /&gt;
&lt;br /&gt;
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu/fndrupal/ framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://adimen.si.ehu.es/web/adimenSUMO adimen-sumo] see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [http://tptp.cs.miami.edu/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors].&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM), BERT and GPT families, plus intro to second lab ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 14 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Loengus plaanime kasutada:&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: transformers and LLMs]&lt;br /&gt;
* [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :)&lt;br /&gt;
&lt;br /&gt;
Mida lisaks vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Kindlasti&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Transformers and Pretrained Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG ===&lt;br /&gt;
&lt;br /&gt;
Useful reading:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning, open/closed world, planning, frame problem, blocks world ===&lt;br /&gt;
&lt;br /&gt;
For intro/recalling hybrid neurosymbolic reasoning:&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems]&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
&lt;br /&gt;
We will then consider planning, open/closed worlds and the frame problem. The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Blocks world examples, then reasoning with uncertainty ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links.&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: continue with uncertainty, then intro to lab 3: 9 April  ===&lt;br /&gt;
&lt;br /&gt;
Numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge: 16 aprill ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing  ===&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid: [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued  ===&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning ja konsultatsioon eksamiks ===&lt;br /&gt;
&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Sample_Gemini_code_and_prompt&amp;diff=22014</id>
		<title>Sample Gemini code and prompt</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Sample_Gemini_code_and_prompt&amp;diff=22014"/>
		<updated>2025-02-26T15:35:34Z</updated>

		<summary type="html">&lt;p&gt;Riina: Uus lehekülg: &amp;#039;&amp;lt;pre&amp;gt; #!/usr/bin/env python3  from google import genai import os  api_key = os.environ[&amp;quot;GEMINI_API_KEY&amp;quot;] client = genai.Client(api_key=api_key)  #cities = [&amp;quot;Tartu&amp;quot;, &amp;quot;Saue&amp;quot;, &amp;quot;Jõg...&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env python3&lt;br /&gt;
&lt;br /&gt;
from google import genai&lt;br /&gt;
import os&lt;br /&gt;
&lt;br /&gt;
api_key = os.environ[&amp;quot;GEMINI_API_KEY&amp;quot;]&lt;br /&gt;
client = genai.Client(api_key=api_key)&lt;br /&gt;
&lt;br /&gt;
#cities = [&amp;quot;Tartu&amp;quot;, &amp;quot;Saue&amp;quot;, &amp;quot;Jõgeva&amp;quot;, &amp;quot;Türi&amp;quot;, &amp;quot;Võhma&amp;quot;, &amp;quot;Kuressaare&amp;quot;, &amp;quot;Paldiski&amp;quot;, &amp;quot;Võru&amp;quot;, &amp;quot;Rakvere&amp;quot;, &amp;quot;Kärdla&amp;quot;, &amp;quot;Rapla&amp;quot;, &amp;quot;Põlva&amp;quot;, &amp;quot;Haapsalu&amp;quot;, &amp;quot;Pärnu&amp;quot;, &amp;quot;Kohtla-Järve&amp;quot;, &amp;quot;Narva&amp;quot;, &amp;quot;Viljandi&amp;quot;, &amp;quot;Valga&amp;quot;, &amp;quot;Tallinn&amp;quot;, &amp;quot;Paide&amp;quot;]&lt;br /&gt;
cities = [&amp;quot;Rapla&amp;quot;, &amp;quot;Saue&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
for city in cities:&lt;br /&gt;
    response = client.models.generate_content(&lt;br /&gt;
        model=&amp;quot;gemini-2.0-flash&amp;quot;, contents=f&amp;quot;What are capacity and other information about the buildings in {city}, Estonia? \&lt;br /&gt;
            Give your answers about the facts as RDF triples, where every triple is on a separate line. Use prefix format for subject, predicate and object. Use prefix llm: as a default prefix. \&lt;br /&gt;
            Use schema.org where possible. Include a triple about schema:location. Output only triples. Do not add comments! Do not add quotes around the numbers!&amp;quot;&lt;br /&gt;
    )&lt;br /&gt;
    print(response.text.strip(&amp;quot;```&amp;quot;).strip(&amp;quot;turtle&amp;quot;))&lt;br /&gt;
    print(f&amp;quot;llm:{city} owl:sameAs yago:{city} .&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=KR_2025_homework_part_1&amp;diff=22013</id>
		<title>KR 2025 homework part 1</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=KR_2025_homework_part_1&amp;diff=22013"/>
		<updated>2025-02-26T15:25:25Z</updated>

		<summary type="html">&lt;p&gt;Riina: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You will have to write a small program to convert/filter data to a suitable format for experimenting with a logical reasoner, add some facts using LLM and then write ca 10 nontrivial rules for answering questions. Number of questions should be ca 5 depending on how complex the rules are. You probably use more then one rule to answer a question. You can also reuse rules to answer other questions.&lt;br /&gt;
&lt;br /&gt;
Finally, experiment with the reasoner on this data + rules and make a small presentation of your data, rules, successes and failures. &lt;br /&gt;
&lt;br /&gt;
The presentation does not have to be made with special slides and a long writeup (although this is also OK). You are expected to show the data, rules and results and briefly explain your ideas, experiments and the work process. Just using an editor for showing this stuff is OK. Best if you can also make a small demo with the reasoner actually running and proving some of the queries.&lt;br /&gt;
&lt;br /&gt;
Not everything you try out needs to work: some failures are also interesting.&lt;br /&gt;
&lt;br /&gt;
We award a few extra points for adventurous people adding extra data into the fray; see the last section about optional stuff.&lt;br /&gt;
&lt;br /&gt;
= Data =&lt;br /&gt;
&lt;br /&gt;
Riina took the large datasets from https://yago-knowledge.org/ and prepared relatively small selections (all about something Estonian) from this data. The link to the files is [https://cs.taltech.ee/staff/riina.maigre/iti8700/lab1/ here]. The data is presented as plain triplets, no fancy encoding (except namespaces) is involved.&lt;br /&gt;
&lt;br /&gt;
This set of files also contains an estonian_taxonomy.txt file, which is a subset of yago-taxonomy.txt. Using some parts of estonian_taxonomy.txt file might help to write more complex rules.&lt;br /&gt;
&lt;br /&gt;
Suggested topics are tourism and entertainment/culture. But you can choose any other topic.&lt;br /&gt;
&lt;br /&gt;
First, please download the files and explore them a bit. Then convert the files to the format our reasoner gk (or its web version http://logictools.org) can eat. Write a program for this! Trying to just replace/filter stuff using an editor will become very cumbersome soon.&lt;br /&gt;
&lt;br /&gt;
For example, the triplet&lt;br /&gt;
    yago:Lake_Peipsi	rdf:type	yago:Lake&lt;br /&gt;
can be converted to&lt;br /&gt;
    triple(yago:Lake_Peipsi,rdf:type,yago:Lake).&lt;br /&gt;
or with the quotation marks&lt;br /&gt;
    triple(&amp;quot;yago:Lake_Peipsi&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Notice that I have not bothered to replace the abbreviations of namespaces like &amp;lt;i&amp;gt;yago&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;rdf&amp;lt;/i&amp;gt; etc with full names &amp;lt;i&amp;gt;http://yago-knowledge.org/resource/&amp;lt;/i&amp;gt; and &lt;br /&gt;
&amp;lt;i&amp;gt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;lt;/i&amp;gt;: the abbreviations make the symbols unique enough for our purposes.&lt;br /&gt;
&lt;br /&gt;
The predicate &amp;lt;i&amp;gt;triple&amp;lt;/i&amp;gt; is really arbitrary: you may use any name you like. You may also use the fourth argument for type, if you wish (like &amp;quot;string&amp;quot;/&amp;quot;integer&amp;quot;/&amp;quot;id&amp;quot;, in case it helps). Importantly, there are subtle differences between writing constants like &amp;lt;i&amp;gt;yago:Lake_Peipsi&amp;lt;/i&amp;gt; with or without quotation marks:&lt;br /&gt;
* Without quotation the reasoner does not assume that two different constants necessarily mean different objects. Saying &amp;lt;i&amp;gt;yago:Lake_Peipsi = yago:Lake_Peipus&amp;lt;/i&amp;gt; does not lead to a contradiction. Also, non-ascii symbols are generally not ok for non-quoted constants.&lt;br /&gt;
* Quotation marks make the reasoner to treat constants as strings, and thus &amp;lt;i&amp;gt;&amp;quot;yago:Lake_Peipsi&amp;quot; = &amp;quot;yago:Lake_Peipus&amp;quot;&amp;lt;/i&amp;gt; is a contradiction. Also, non-ascii symbols are OK.&lt;br /&gt;
&lt;br /&gt;
Observe that the datasets contain a huge amount of labels (i.e. human names) and comments in different languages, like&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@sh      .&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@lfn     .&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@es      .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Tartu&amp;quot;@ko      .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Tartu&amp;quot;@mhr     .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Jurjev&amp;quot;@cs     .&lt;br /&gt;
  yago:Tartu_Art_House	rdfs:comment	&amp;quot;museum di Estonia&amp;quot;@id	.&lt;br /&gt;
  yago:Tartu_Art_House	rdfs:comment	&amp;quot;Museum in Estland&amp;quot;@de	.&lt;br /&gt;
&lt;br /&gt;
You may safely remove all the comments and most (or all) names, except these which you really use in your questions and rules, if any. For example, you may want to keep just one &amp;lt;i&amp;gt;rdfs:label&amp;lt;/i&amp;gt; for an object, without indicating a language (the @-stuff) at all.&lt;br /&gt;
&lt;br /&gt;
= LLM generated data =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ideas for adding additional facts sightseeing objects, what is close to what etc for tourism and facts about actors or musicians etc for entertainment/culture.&lt;br /&gt;
&lt;br /&gt;
You can either ask for facts formatted in RDF triples and convert them into logic. Or you can ask facts in logic. Experiment what works best!&lt;br /&gt;
&lt;br /&gt;
You can use any LLM chat or API. For API usage there are some almost free options.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [https://mistral.ai/ mistral.ai] you can try API for free (150.00€/month limit), in exchange your API requests may be used to improve their services.&lt;br /&gt;
&lt;br /&gt;
* [https://together.ai together.ai] that allows you to use open source LLMs for a small fee. Two of their models are available for free: Llama-3.3-70B-Instruct-Turbo-Free and DeepSeek-R1-Distill-Llama-70B-free. They used to have 25$ credit for new users, but this might not be the case anymore.&lt;br /&gt;
&lt;br /&gt;
* [https://aistudio.google.com/ aistudio.google.com] Google AI Studio now also allows to create an API key (includes a free tier), that can be used to make request over Gemini API (see the documentation: https://ai.google.dev/gemini-api/docs) for more information. See [[sample Gemini code and prompt]] used in practice session for inspiration. Note that you might not get the same results even when using the same model and prompt.&lt;br /&gt;
&lt;br /&gt;
* [https://ollama.com/ ollama.com] makes it easy to run free models on local computer. Smaller models run even without GPU.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cheahjs/free-llm-api-resources List of additional resources that have free options]&lt;br /&gt;
&lt;br /&gt;
= Rules and questions =&lt;br /&gt;
&lt;br /&gt;
The best way to try out rules and questions is to use http://logictools.org for quick experiments along with small selections of data. For example, try&lt;br /&gt;
&lt;br /&gt;
  triple(&amp;quot;yago:Lake_Peipsi&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(X,Y,&amp;quot;yago:Lake&amp;quot;) =&amp;gt; $ans(X).&lt;br /&gt;
&lt;br /&gt;
and you should get a single answer along with the trivial proof. To get more answers, click the &amp;quot;Advanced&amp;quot; button and copy { &amp;quot;max_answers&amp;quot;: 2} into the strategy box. Beware that in case you ask for more answers than there really are, the reasoner may just keeping looking for more, eventually timeouting, and not giving any answers at all.&lt;br /&gt;
&lt;br /&gt;
Now let us try out something simple, but not totally trivial:&lt;br /&gt;
&lt;br /&gt;
  triple(yago:Jaan_Lepp,	schema:birthPlace,      yago:Anija_Parish).&lt;br /&gt;
  triple(yago:August_Vaga,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  triple(yago:Silvi_Vrait,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  triple(yago:Karmen_Pedaru,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,schema:birthPlace,Z) =&amp;gt; bornin(X,K).&lt;br /&gt;
  &lt;br /&gt;
  bornin(X,Z) &amp;amp; bornin(Y,Z) =&amp;gt; borninsameplace(X,Y).&lt;br /&gt;
  &lt;br /&gt;
  borninsameplace(X,Y) &amp;amp; -$substr(X,Y) &amp;amp; -$substr(Y,X)  =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
Put, say &amp;lt;i&amp;gt;{ &amp;quot;max_answers&amp;quot;: 3}&amp;lt;/i&amp;gt; to the strategy box, to get more answers than one.&lt;br /&gt;
&lt;br /&gt;
Here we took a small selection of data from one of the files and added a few rules. Notice the trick with the special builtin predicate &amp;lt;i&amp;gt;$substr(K,Z)&amp;lt;/i&amp;gt;: it treats the argument constants as strings and checks whether the first one is a substring of the second one. Thus the &amp;lt;i&amp;gt;-$substr(X,Y) &amp;amp; -$substr(Y,X)&amp;lt;/i&amp;gt; simply eliminates equal constants  to avoid answers like &amp;lt;i&amp;gt;$ans(&#039;yago:August_Vaga&#039;,&#039;yago:August_Vaga&#039;).&amp;lt;/i&amp;gt;. Alternatively, if we had used the quotation marks around person id-s, we could have used the rule&lt;br /&gt;
&lt;br /&gt;
  borninsameplace(X,Y) &amp;amp; X!=Y =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
instead.&lt;br /&gt;
&lt;br /&gt;
Next, a slightly more interesting example (use &amp;lt;i&amp;gt;{ &amp;quot;max_answers&amp;quot;: 6}&amp;lt;/i&amp;gt; or less):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  triple(&amp;quot;yago:Lake_Peipus&amp;quot;,&amp;quot;rdf:type&amp;quot;,	&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Veisjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  &lt;br /&gt;
  triple(&amp;quot;yago:Väike_Emajõgi&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Tänassilma_River&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Tarvastu_River&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Emajõgi&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Veisjärv&amp;quot;,&amp;quot;yago:flowsInto&amp;quot;,&amp;quot;yago:Õhne&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Õhne&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Emajõgi&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Lake_Peipus&amp;quot;).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,&amp;quot;yago:flowsInto&amp;quot;,Y) =&amp;gt; boattravel(X,Y).&lt;br /&gt;
  triple(X,&amp;quot;yago:flowsInto&amp;quot;,Y) =&amp;gt; boattravel(Y,X).&lt;br /&gt;
  &lt;br /&gt;
  boattravel(X,Y) &amp;amp; boattravel(Y,Z) =&amp;gt; boattravel(X,Z).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;) &amp;amp; triple(Z,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;) &amp;amp; boattravel(X,Y) &amp;amp; boattravel(Y,Z) &amp;amp; X!=Z =&amp;gt; laketolake(X,Z).&lt;br /&gt;
  laketolake(X,Y) =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
Interestingly, the Yago dataset uses two different id-s for Peipsi: &amp;lt;i&amp;gt;yago:Lake_Peipus&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;yago:Lake_Peipsi&amp;lt;/i&amp;gt; with several additional triplets indicating equality of these id-s to some other id-s, but not to each other! The related datasets for these id-s are also different. Conceptually, this is an errorish thingy in Yago.&lt;br /&gt;
&lt;br /&gt;
  yago:Lake_Peipsi	rdf:type	yago:Lake&lt;br /&gt;
  yago:Lake_Peipsi	owl:sameAs	wd:Q2627792&lt;br /&gt;
  yago:Lake_Peipsi	schema:sameAs	&amp;quot;/g/1217z1dh&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  yago:Lake_Peipus	rdf:type	yago:Lake&lt;br /&gt;
  yago:Lake_Peipus	owl:sameAs	wd:Q19253&lt;br /&gt;
  yago:Lake_Peipus	schema:sameAs	&amp;quot;/m/021yh2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Ideas for writing your own rules =&lt;br /&gt;
&lt;br /&gt;
The main recommendation is thinking what nontrivial things we could ask from the dataset and then looking whether it actually contains sufficient data for this. If you have an idea, try it out with small examples first.&lt;br /&gt;
&lt;br /&gt;
Try to combine different rules requiring the generation of longer nontrivial proofs for answers.&lt;br /&gt;
&lt;br /&gt;
Some ideas, including somewhat crazy ones:&lt;br /&gt;
&lt;br /&gt;
* Categorizing objects into larger categories, using the transivity of rdf:type (you have to write your own rule for the transitivity). &lt;br /&gt;
* What city/town/lake/island is inside what, according to located-in-estonia.txt. What can you derive from this, say, using transitivity of &amp;lt;i&amp;gt;inside&amp;lt;/i&amp;gt;?&lt;br /&gt;
* Who was born where and how could they potentially travel with the boat to a place another person was born :)&lt;br /&gt;
* Finding data from people-in-estonia.txt for persons active in created-in-estonia.txt. Finding people born nearby active in the same movies. Etc.&lt;br /&gt;
* Convert birth dates like &amp;lt;i&amp;gt;yago:Endel_Ruberg       schema:birthDate        &amp;quot;1917-05-21T00:00:00Z&amp;quot;^^xsd:dateTime&amp;lt;/i&amp;gt; to simple integers and use the built-in arithmetic of th e reasoner (see &amp;quot;About&amp;quot; -&amp;gt; &amp;quot;Special symbols and additional constructions&amp;quot; in logictools) to filter out suitable people. Who is surely not alive any more? Who are roughly of the same age and have something more in common?&lt;br /&gt;
* Converting triplets in the dataset &amp;lt;i&amp;gt;triple(a,b,c)&amp;lt;/i&amp;gt; where the first and second argument should conceptually strictly determine the third (like when c is a birthdate) to equalities like &amp;lt;i&amp;gt;b(a)=c&amp;lt;/i&amp;gt; instead and then using terms and equalities in your rules for such cases.&lt;br /&gt;
* Generating trips with actual paths shown in answers: you will need function term arguments in your predicates for this, see the example from the first lecture:&lt;br /&gt;
&lt;br /&gt;
  railroad(tallinn,tapa).&lt;br /&gt;
  railroad(tapa,tartu).&lt;br /&gt;
  highway(tallinn,virtsu).&lt;br /&gt;
  sealane(virtsu,kuivastu).&lt;br /&gt;
  highway(kuressaare,kuivastu).&lt;br /&gt;
  railroad(X,Y) =&amp;gt; railroad(Y,X).&lt;br /&gt;
  highway(X,Y) =&amp;gt; highway(Y,X).&lt;br /&gt;
  sealane(X,Y) =&amp;gt; sealane(Y,X).&lt;br /&gt;
  railroad(X,Y) =&amp;gt; easytravel(X,Y,use(train,X,Y)).&lt;br /&gt;
  highway(X,Y) =&amp;gt; easytravel(X,Y,use(bus,X,Y)).&lt;br /&gt;
  sealane(X,Y) =&amp;gt; easytravel(X,Y,use(ship,X,Y)).&lt;br /&gt;
  easytravel(X,Y,P1) &amp;amp; easytravel(Y,Z,P2) =&amp;gt; easytravel(X,Z,combine(P1,P2)).&lt;br /&gt;
  easytravel(tartu,X,Y) &amp;amp; spacity(X) =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
= Using large datasets: logictools vs command line reasoner gkc =&lt;br /&gt;
&lt;br /&gt;
Logictools is unable to eat very large datasets and the options to control it are limited. Also, experimenting only on the web may be cumbersome. &lt;br /&gt;
&lt;br /&gt;
Thus I&#039;d recommend to download the full-powered version of the reasoner used in logictools  from https://github.com/tammet/gkc : it is best to use the somewhat older release https://github.com/tammet/gkc/releases/tag/v0.6.0 which has the same codebase as logictools. Just take the provided windows, linux or macos binary: no need to compile yourself.&lt;br /&gt;
&lt;br /&gt;
A rather thorough tutorial of gkc with examples is README.md here: https://github.com/tammet/gkc/blob/master/Examples/README.md&lt;br /&gt;
&lt;br /&gt;
= Optional: additional datasets =&lt;br /&gt;
&lt;br /&gt;
In case you are adventurous, try to use additional datasets and combine these with the ones provided by Riina! For example, the Yago stuff contains triplets like&lt;br /&gt;
&lt;br /&gt;
  yago:Lake_Peipsi	owl:sameAs	wd:Q2627792 &lt;br /&gt;
&lt;br /&gt;
with the &amp;quot;wd:&amp;quot; defined above as &amp;quot;http://www.wikidata.org/entity/&amp;quot;, thus leading to pages like  http://www.wikidata.org/entity/Q2627792 . Now, looking at the source of this page, you find rows like &amp;lt;code&amp;gt;&amp;lt;link rel=&amp;quot;alternate&amp;quot; href=&amp;quot;https://www.wikidata.org/wiki/Special:EntityData/Q2627792.nt&amp;quot; type=&amp;quot;application/n-triples&amp;quot;&amp;gt;&amp;lt;/code&amp;gt; with the link &lt;br /&gt;
https://www.wikidata.org/wiki/Special:EntityData/Q2627792.nt leading to a large set of triplets related to Lake Peipsi! Most of these represent some specific complex encodings of this wikidata web page itself, but several are actually about Peipsi.&lt;br /&gt;
&lt;br /&gt;
A list of well-known and used large &amp;quot;generic&amp;quot; fact and knowledge bases can be found in http://lambda.ee/wiki/Teadmiste_formaliseerimine#Block_3:_General-knowledge_databases . You may want to have a look at these, but beware: obviously it takes time to understand and process. Another cool source is [https://www.kaggle.com/datasets kaggle.]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=KR_2025_homework_part_1&amp;diff=22012</id>
		<title>KR 2025 homework part 1</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=KR_2025_homework_part_1&amp;diff=22012"/>
		<updated>2025-02-23T14:07:39Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* LLM generated data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You will have to write a small program to convert/filter data to a suitable format for experimenting with a logical reasoner, and then write ca 10 nontrivial rules for answering questions. Add some facts using LLM.&lt;br /&gt;
&lt;br /&gt;
Finally, experiment with the reasoner on this data + rules and make a small presentation of your data, rules, successes and failures. &lt;br /&gt;
&lt;br /&gt;
The presentation does not have to be made with special slides and a long writeup (although this is also OK). You are expected to show the data, rules and results and briefly explain your ideas, experiments and the work process. Just using an editor for showing this stuff is OK. Best if you can also make a small demo with the reasoner actually running and proving some of the queries.&lt;br /&gt;
&lt;br /&gt;
Not everything you try out needs to work: some failures are also interesting.&lt;br /&gt;
&lt;br /&gt;
We award a few extra points for adventurous people adding extra data into the fray; see the last section about optional stuff.&lt;br /&gt;
&lt;br /&gt;
= Data =&lt;br /&gt;
&lt;br /&gt;
Riina took the large datasets from https://yago-knowledge.org/ and prepared relatively small selections (all about something Estonian) from this data. The link to the files is [https://cs.taltech.ee/staff/riina.maigre/iti8700/lab1/ here]. The data is presented as plain triplets, no fancy encoding (except namespaces) is involved.&lt;br /&gt;
&lt;br /&gt;
This set of files also contains an estonian_taxonomy.txt file, which is a subset of yago-taxonomy.txt. Using some parts of estonian_taxonomy.txt file might help to write more complex rules.&lt;br /&gt;
&lt;br /&gt;
Suggested topics are tourism and entertainment/culture. But you can choose any other topic.&lt;br /&gt;
&lt;br /&gt;
First, please download the files and explore them a bit. Then convert the files to the format our reasoner gk (or its web version http://logictools.org) can eat. Write a program for this! Trying to just replace/filter stuff using an editor will become very cumbersome soon.&lt;br /&gt;
&lt;br /&gt;
For example, the triplet&lt;br /&gt;
    yago:Lake_Peipsi	rdf:type	yago:Lake&lt;br /&gt;
can be converted to&lt;br /&gt;
    triple(yago:Lake_Peipsi,rdf:type,yago:Lake).&lt;br /&gt;
or with the quotation marks&lt;br /&gt;
    triple(&amp;quot;yago:Lake_Peipsi&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Notice that I have not bothered to replace the abbreviations of namespaces like &amp;lt;i&amp;gt;yago&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;rdf&amp;lt;/i&amp;gt; etc with full names &amp;lt;i&amp;gt;http://yago-knowledge.org/resource/&amp;lt;/i&amp;gt; and &lt;br /&gt;
&amp;lt;i&amp;gt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;lt;/i&amp;gt;: the abbreviations make the symbols unique enough for our purposes.&lt;br /&gt;
&lt;br /&gt;
The predicate &amp;lt;i&amp;gt;triple&amp;lt;/i&amp;gt; is really arbitrary: you may use any name you like. You may also use the fourth argument for type, if you wish (like &amp;quot;string&amp;quot;/&amp;quot;integer&amp;quot;/&amp;quot;id&amp;quot;, in case it helps). Importantly, there are subtle differences between writing constants like &amp;lt;i&amp;gt;yago:Lake_Peipsi&amp;lt;/i&amp;gt; with or without quotation marks:&lt;br /&gt;
* Without quotation the reasoner does not assume that two different constants necessarily mean different objects. Saying &amp;lt;i&amp;gt;yago:Lake_Peipsi = yago:Lake_Peipus&amp;lt;/i&amp;gt; does not lead to a contradiction. Also, non-ascii symbols are generally not ok for non-quoted constants.&lt;br /&gt;
* Quotation marks make the reasoner to treat constants as strings, and thus &amp;lt;i&amp;gt;&amp;quot;yago:Lake_Peipsi&amp;quot; = &amp;quot;yago:Lake_Peipus&amp;quot;&amp;lt;/i&amp;gt; is a contradiction. Also, non-ascii symbols are OK.&lt;br /&gt;
&lt;br /&gt;
Observe that the datasets contain a huge amount of labels (i.e. human names) and comments in different languages, like&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@sh      .&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@lfn     .&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@es      .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Tartu&amp;quot;@ko      .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Tartu&amp;quot;@mhr     .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Jurjev&amp;quot;@cs     .&lt;br /&gt;
  yago:Tartu_Art_House	rdfs:comment	&amp;quot;museum di Estonia&amp;quot;@id	.&lt;br /&gt;
  yago:Tartu_Art_House	rdfs:comment	&amp;quot;Museum in Estland&amp;quot;@de	.&lt;br /&gt;
&lt;br /&gt;
You may safely remove all the comments and most (or all) names, except these which you really use in your questions and rules, if any. For example, you may want to keep just one &amp;lt;i&amp;gt;rdfs:label&amp;lt;/i&amp;gt; for an object, without indicating a language (the @-stuff) at all.&lt;br /&gt;
&lt;br /&gt;
= LLM generated data =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ideas for adding additional facts sightseeing objects, what is close to what etc for tourism and facts about actors or musicians etc for entertainment/culture.&lt;br /&gt;
&lt;br /&gt;
You can either ask for facts formatted in RDF triples and convert them into logic. Or you can ask facts in logic. Experiment what works best!&lt;br /&gt;
&lt;br /&gt;
You can use any LLM chat or API. For API usage there are some almost free options.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [https://mistral.ai/ mistral.ai] you can try API for free (150.00€/month limit), in exchange your API requests may be used to improve their services.&lt;br /&gt;
&lt;br /&gt;
* [https://together.ai together.ai] that allows you to use open source LLMs for a small fee. Two of their models are available for free: Llama-3.3-70B-Instruct-Turbo-Free and DeepSeek-R1-Distill-Llama-70B-free. They used to have 25$ credit for new users, but this might not be the case anymore.&lt;br /&gt;
&lt;br /&gt;
* [https://aistudio.google.com/ aistudio.google.com] Google AI Studio now also allows to create an API key (includes a free tier), that can be used to make request over Gemini API (see the documentation: https://ai.google.dev/gemini-api/docs) for more information.&lt;br /&gt;
&lt;br /&gt;
* [https://ollama.com/ ollama.com] makes it easy to run free models on local computer. Smaller models run even without GPU.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cheahjs/free-llm-api-resources List of additional resources that have free options]&lt;br /&gt;
&lt;br /&gt;
= Rules and questions =&lt;br /&gt;
&lt;br /&gt;
The best way to try out rules and questions is to use http://logictools.org for quick experiments along with small selections of data. For example, try&lt;br /&gt;
&lt;br /&gt;
  triple(&amp;quot;yago:Lake_Peipsi&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(X,Y,&amp;quot;yago:Lake&amp;quot;) =&amp;gt; $ans(X).&lt;br /&gt;
&lt;br /&gt;
and you should get a single answer along with the trivial proof. To get more answers, click the &amp;quot;Advanced&amp;quot; button and copy { &amp;quot;max_answers&amp;quot;: 2} into the strategy box. Beware that in case you ask for more answers than there really are, the reasoner may just keeping looking for more, eventually timeouting, and not giving any answers at all.&lt;br /&gt;
&lt;br /&gt;
Now let us try out something simple, but not totally trivial:&lt;br /&gt;
&lt;br /&gt;
  triple(yago:Jaan_Lepp,	schema:birthPlace,      yago:Anija_Parish).&lt;br /&gt;
  triple(yago:August_Vaga,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  triple(yago:Silvi_Vrait,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  triple(yago:Karmen_Pedaru,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,schema:birthPlace,Z) =&amp;gt; bornin(X,K).&lt;br /&gt;
  &lt;br /&gt;
  bornin(X,Z) &amp;amp; bornin(Y,Z) =&amp;gt; borninsameplace(X,Y).&lt;br /&gt;
  &lt;br /&gt;
  borninsameplace(X,Y) &amp;amp; -$substr(X,Y) &amp;amp; -$substr(Y,X)  =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
Put, say &amp;lt;i&amp;gt;{ &amp;quot;max_answers&amp;quot;: 3}&amp;lt;/i&amp;gt; to the strategy box, to get more answers than one.&lt;br /&gt;
&lt;br /&gt;
Here we took a small selection of data from one of the files and added a few rules. Notice the trick with the special builtin predicate &amp;lt;i&amp;gt;$substr(K,Z)&amp;lt;/i&amp;gt;: it treats the argument constants as strings and checks whether the first one is a substring of the second one. Thus the &amp;lt;i&amp;gt;-$substr(X,Y) &amp;amp; -$substr(Y,X)&amp;lt;/i&amp;gt; simply eliminates equal constants  to avoid answers like &amp;lt;i&amp;gt;$ans(&#039;yago:August_Vaga&#039;,&#039;yago:August_Vaga&#039;).&amp;lt;/i&amp;gt;. Alternatively, if we had used the quotation marks around person id-s, we could have used the rule&lt;br /&gt;
&lt;br /&gt;
  borninsameplace(X,Y) &amp;amp; X!=Y =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
instead.&lt;br /&gt;
&lt;br /&gt;
Next, a slightly more interesting example (use &amp;lt;i&amp;gt;{ &amp;quot;max_answers&amp;quot;: 6}&amp;lt;/i&amp;gt; or less):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  triple(&amp;quot;yago:Lake_Peipus&amp;quot;,&amp;quot;rdf:type&amp;quot;,	&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Veisjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  &lt;br /&gt;
  triple(&amp;quot;yago:Väike_Emajõgi&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Tänassilma_River&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Tarvastu_River&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Emajõgi&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Veisjärv&amp;quot;,&amp;quot;yago:flowsInto&amp;quot;,&amp;quot;yago:Õhne&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Õhne&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Emajõgi&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Lake_Peipus&amp;quot;).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,&amp;quot;yago:flowsInto&amp;quot;,Y) =&amp;gt; boattravel(X,Y).&lt;br /&gt;
  triple(X,&amp;quot;yago:flowsInto&amp;quot;,Y) =&amp;gt; boattravel(Y,X).&lt;br /&gt;
  &lt;br /&gt;
  boattravel(X,Y) &amp;amp; boattravel(Y,Z) =&amp;gt; boattravel(X,Z).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;) &amp;amp; triple(Z,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;) &amp;amp; boattravel(X,Y) &amp;amp; boattravel(Y,Z) &amp;amp; X!=Z =&amp;gt; laketolake(X,Z).&lt;br /&gt;
  laketolake(X,Y) =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
Interestingly, the Yago dataset uses two different id-s for Peipsi: &amp;lt;i&amp;gt;yago:Lake_Peipus&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;yago:Lake_Peipsi&amp;lt;/i&amp;gt; with several additional triplets indicating equality of these id-s to some other id-s, but not to each other! The related datasets for these id-s are also different. Conceptually, this is an errorish thingy in Yago.&lt;br /&gt;
&lt;br /&gt;
  yago:Lake_Peipsi	rdf:type	yago:Lake&lt;br /&gt;
  yago:Lake_Peipsi	owl:sameAs	wd:Q2627792&lt;br /&gt;
  yago:Lake_Peipsi	schema:sameAs	&amp;quot;/g/1217z1dh&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  yago:Lake_Peipus	rdf:type	yago:Lake&lt;br /&gt;
  yago:Lake_Peipus	owl:sameAs	wd:Q19253&lt;br /&gt;
  yago:Lake_Peipus	schema:sameAs	&amp;quot;/m/021yh2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Ideas for writing your own rules =&lt;br /&gt;
&lt;br /&gt;
The main recommendation is thinking what nontrivial things we could ask from the dataset and then looking whether it actually contains sufficient data for this. If you have an idea, try it out with small examples first.&lt;br /&gt;
&lt;br /&gt;
Try to combine different rules requiring the generation of longer nontrivial proofs for answers.&lt;br /&gt;
&lt;br /&gt;
Some ideas, including somewhat crazy ones:&lt;br /&gt;
&lt;br /&gt;
* Categorizing objects into larger categories, using the transivity of rdf:type (you have to write your own rule for the transitivity). &lt;br /&gt;
* What city/town/lake/island is inside what, according to located-in-estonia.txt. What can you derive from this, say, using transitivity of &amp;lt;i&amp;gt;inside&amp;lt;/i&amp;gt;?&lt;br /&gt;
* Who was born where and how could they potentially travel with the boat to a place another person was born :)&lt;br /&gt;
* Finding data from people-in-estonia.txt for persons active in created-in-estonia.txt. Finding people born nearby active in the same movies. Etc.&lt;br /&gt;
* Convert birth dates like &amp;lt;i&amp;gt;yago:Endel_Ruberg       schema:birthDate        &amp;quot;1917-05-21T00:00:00Z&amp;quot;^^xsd:dateTime&amp;lt;/i&amp;gt; to simple integers and use the built-in arithmetic of th e reasoner (see &amp;quot;About&amp;quot; -&amp;gt; &amp;quot;Special symbols and additional constructions&amp;quot; in logictools) to filter out suitable people. Who is surely not alive any more? Who are roughly of the same age and have something more in common?&lt;br /&gt;
* Converting triplets in the dataset &amp;lt;i&amp;gt;triple(a,b,c)&amp;lt;/i&amp;gt; where the first and second argument should conceptually strictly determine the third (like when c is a birthdate) to equalities like &amp;lt;i&amp;gt;b(a)=c&amp;lt;/i&amp;gt; instead and then using terms and equalities in your rules for such cases.&lt;br /&gt;
* Generating trips with actual paths shown in answers: you will need function term arguments in your predicates for this, see the example from the first lecture:&lt;br /&gt;
&lt;br /&gt;
  railroad(tallinn,tapa).&lt;br /&gt;
  railroad(tapa,tartu).&lt;br /&gt;
  highway(tallinn,virtsu).&lt;br /&gt;
  sealane(virtsu,kuivastu).&lt;br /&gt;
  highway(kuressaare,kuivastu).&lt;br /&gt;
  railroad(X,Y) =&amp;gt; railroad(Y,X).&lt;br /&gt;
  highway(X,Y) =&amp;gt; highway(Y,X).&lt;br /&gt;
  sealane(X,Y) =&amp;gt; sealane(Y,X).&lt;br /&gt;
  railroad(X,Y) =&amp;gt; easytravel(X,Y,use(train,X,Y)).&lt;br /&gt;
  highway(X,Y) =&amp;gt; easytravel(X,Y,use(bus,X,Y)).&lt;br /&gt;
  sealane(X,Y) =&amp;gt; easytravel(X,Y,use(ship,X,Y)).&lt;br /&gt;
  easytravel(X,Y,P1) &amp;amp; easytravel(Y,Z,P2) =&amp;gt; easytravel(X,Z,combine(P1,P2)).&lt;br /&gt;
  easytravel(tartu,X,Y) &amp;amp; spacity(X) =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
= Using large datasets: logictools vs command line reasoner gkc =&lt;br /&gt;
&lt;br /&gt;
Logictools is unable to eat very large datasets and the options to control it are limited. Also, experimenting only on the web may be cumbersome. &lt;br /&gt;
&lt;br /&gt;
Thus I&#039;d recommend to download the full-powered version of the reasoner used in logictools  from https://github.com/tammet/gkc : it is best to use the somewhat older release https://github.com/tammet/gkc/releases/tag/v0.6.0 which has the same codebase as logictools. Just take the provided windows, linux or macos binary: no need to compile yourself.&lt;br /&gt;
&lt;br /&gt;
A rather thorough tutorial of gkc with examples is README.md here: https://github.com/tammet/gkc/blob/master/Examples/README.md&lt;br /&gt;
&lt;br /&gt;
= Optional: additional datasets =&lt;br /&gt;
&lt;br /&gt;
In case you are adventurous, try to use additional datasets and combine these with the ones provided by Riina! For example, the Yago stuff contains triplets like&lt;br /&gt;
&lt;br /&gt;
  yago:Lake_Peipsi	owl:sameAs	wd:Q2627792 &lt;br /&gt;
&lt;br /&gt;
with the &amp;quot;wd:&amp;quot; defined above as &amp;quot;http://www.wikidata.org/entity/&amp;quot;, thus leading to pages like  http://www.wikidata.org/entity/Q2627792 . Now, looking at the source of this page, you find rows like &amp;lt;code&amp;gt;&amp;lt;link rel=&amp;quot;alternate&amp;quot; href=&amp;quot;https://www.wikidata.org/wiki/Special:EntityData/Q2627792.nt&amp;quot; type=&amp;quot;application/n-triples&amp;quot;&amp;gt;&amp;lt;/code&amp;gt; with the link &lt;br /&gt;
https://www.wikidata.org/wiki/Special:EntityData/Q2627792.nt leading to a large set of triplets related to Lake Peipsi! Most of these represent some specific complex encodings of this wikidata web page itself, but several are actually about Peipsi.&lt;br /&gt;
&lt;br /&gt;
A list of well-known and used large &amp;quot;generic&amp;quot; fact and knowledge bases can be found in http://lambda.ee/wiki/Teadmiste_formaliseerimine#Block_3:_General-knowledge_databases . You may want to have a look at these, but beware: obviously it takes time to understand and process. Another cool source is [https://www.kaggle.com/datasets kaggle.]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=KR_2025_homework_part_1&amp;diff=22011</id>
		<title>KR 2025 homework part 1</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=KR_2025_homework_part_1&amp;diff=22011"/>
		<updated>2025-02-18T16:00:41Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* LLM generated data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You will have to write a small program to convert/filter data to a suitable format for experimenting with a logical reasoner, and then write ca 10 nontrivial rules for answering questions. Add some facts using LLM.&lt;br /&gt;
&lt;br /&gt;
Finally, experiment with the reasoner on this data + rules and make a small presentation of your data, rules, successes and failures. &lt;br /&gt;
&lt;br /&gt;
The presentation does not have to be made with special slides and a long writeup (although this is also OK). You are expected to show the data, rules and results and briefly explain your ideas, experiments and the work process. Just using an editor for showing this stuff is OK. Best if you can also make a small demo with the reasoner actually running and proving some of the queries.&lt;br /&gt;
&lt;br /&gt;
Not everything you try out needs to work: some failures are also interesting.&lt;br /&gt;
&lt;br /&gt;
We award a few extra points for adventurous people adding extra data into the fray; see the last section about optional stuff.&lt;br /&gt;
&lt;br /&gt;
= Data =&lt;br /&gt;
&lt;br /&gt;
Riina took the large datasets from https://yago-knowledge.org/ and prepared relatively small selections (all about something Estonian) from this data. The link to the files is [https://cs.taltech.ee/staff/riina.maigre/iti8700/lab1/ here]. The data is presented as plain triplets, no fancy encoding (except namespaces) is involved.&lt;br /&gt;
&lt;br /&gt;
This set of files also contains an estonian_taxonomy.txt file, which is a subset of yago-taxonomy.txt. Using some parts of estonian_taxonomy.txt file might help to write more complex rules.&lt;br /&gt;
&lt;br /&gt;
Suggested topics are tourism and entertainment/culture. But you can choose any other topic.&lt;br /&gt;
&lt;br /&gt;
First, please download the files and explore them a bit. Then convert the files to the format our reasoner gk (or its web version http://logictools.org) can eat. Write a program for this! Trying to just replace/filter stuff using an editor will become very cumbersome soon.&lt;br /&gt;
&lt;br /&gt;
For example, the triplet&lt;br /&gt;
    yago:Lake_Peipsi	rdf:type	yago:Lake&lt;br /&gt;
can be converted to&lt;br /&gt;
    triple(yago:Lake_Peipsi,rdf:type,yago:Lake).&lt;br /&gt;
or with the quotation marks&lt;br /&gt;
    triple(&amp;quot;yago:Lake_Peipsi&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Notice that I have not bothered to replace the abbreviations of namespaces like &amp;lt;i&amp;gt;yago&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;rdf&amp;lt;/i&amp;gt; etc with full names &amp;lt;i&amp;gt;http://yago-knowledge.org/resource/&amp;lt;/i&amp;gt; and &lt;br /&gt;
&amp;lt;i&amp;gt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;lt;/i&amp;gt;: the abbreviations make the symbols unique enough for our purposes.&lt;br /&gt;
&lt;br /&gt;
The predicate &amp;lt;i&amp;gt;triple&amp;lt;/i&amp;gt; is really arbitrary: you may use any name you like. You may also use the fourth argument for type, if you wish (like &amp;quot;string&amp;quot;/&amp;quot;integer&amp;quot;/&amp;quot;id&amp;quot;, in case it helps). Importantly, there are subtle differences between writing constants like &amp;lt;i&amp;gt;yago:Lake_Peipsi&amp;lt;/i&amp;gt; with or without quotation marks:&lt;br /&gt;
* Without quotation the reasoner does not assume that two different constants necessarily mean different objects. Saying &amp;lt;i&amp;gt;yago:Lake_Peipsi = yago:Lake_Peipus&amp;lt;/i&amp;gt; does not lead to a contradiction. Also, non-ascii symbols are generally not ok for non-quoted constants.&lt;br /&gt;
* Quotation marks make the reasoner to treat constants as strings, and thus &amp;lt;i&amp;gt;&amp;quot;yago:Lake_Peipsi&amp;quot; = &amp;quot;yago:Lake_Peipus&amp;quot;&amp;lt;/i&amp;gt; is a contradiction. Also, non-ascii symbols are OK.&lt;br /&gt;
&lt;br /&gt;
Observe that the datasets contain a huge amount of labels (i.e. human names) and comments in different languages, like&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@sh      .&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@lfn     .&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@es      .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Tartu&amp;quot;@ko      .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Tartu&amp;quot;@mhr     .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Jurjev&amp;quot;@cs     .&lt;br /&gt;
  yago:Tartu_Art_House	rdfs:comment	&amp;quot;museum di Estonia&amp;quot;@id	.&lt;br /&gt;
  yago:Tartu_Art_House	rdfs:comment	&amp;quot;Museum in Estland&amp;quot;@de	.&lt;br /&gt;
&lt;br /&gt;
You may safely remove all the comments and most (or all) names, except these which you really use in your questions and rules, if any. For example, you may want to keep just one &amp;lt;i&amp;gt;rdfs:label&amp;lt;/i&amp;gt; for an object, without indicating a language (the @-stuff) at all.&lt;br /&gt;
&lt;br /&gt;
= LLM generated data =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ideas for adding additional facts sightseeing objects, what is close to what etc for tourism and facts about actors or musicians etc for entertainment/culture.&lt;br /&gt;
&lt;br /&gt;
You can either ask for facts formatted in RDF triples and convert them into logic. Or you can ask facts in logic. Experiment what works best!&lt;br /&gt;
&lt;br /&gt;
You can use any LLM chat or API. For API usage there are some almost free options.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [https://mistral.ai/ mistral.ai] you can try API for free (150.00€/month limit), in exchange your API requests may be used to improve their services.&lt;br /&gt;
&lt;br /&gt;
* [https://together.ai together.ai] that allows you to use open source LLMs for a small fee. Two of their models are available for free: Llama-3.3-70B-Instruct-Turbo-Free and DeepSeek-R1-Distill-Llama-70B-free. They used to have 25$ credit for new users, but this might not be the case anymore.&lt;br /&gt;
&lt;br /&gt;
* [https://ollama.com/ ollama.com] makes it easy to run free models on local computer. Smaller models run even without GPU.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/cheahjs/free-llm-api-resources List of additional resources that have free options]&lt;br /&gt;
&lt;br /&gt;
= Rules and questions =&lt;br /&gt;
&lt;br /&gt;
The best way to try out rules and questions is to use http://logictools.org for quick experiments along with small selections of data. For example, try&lt;br /&gt;
&lt;br /&gt;
  triple(&amp;quot;yago:Lake_Peipsi&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(X,Y,&amp;quot;yago:Lake&amp;quot;) =&amp;gt; $ans(X).&lt;br /&gt;
&lt;br /&gt;
and you should get a single answer along with the trivial proof. To get more answers, click the &amp;quot;Advanced&amp;quot; button and copy { &amp;quot;max_answers&amp;quot;: 2} into the strategy box. Beware that in case you ask for more answers than there really are, the reasoner may just keeping looking for more, eventually timeouting, and not giving any answers at all.&lt;br /&gt;
&lt;br /&gt;
Now let us try out something simple, but not totally trivial:&lt;br /&gt;
&lt;br /&gt;
  triple(yago:Jaan_Lepp,	schema:birthPlace,      yago:Anija_Parish).&lt;br /&gt;
  triple(yago:August_Vaga,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  triple(yago:Silvi_Vrait,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  triple(yago:Karmen_Pedaru,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,schema:birthPlace,Z) =&amp;gt; bornin(X,K).&lt;br /&gt;
  &lt;br /&gt;
  bornin(X,Z) &amp;amp; bornin(Y,Z) =&amp;gt; borninsameplace(X,Y).&lt;br /&gt;
  &lt;br /&gt;
  borninsameplace(X,Y) &amp;amp; -$substr(X,Y) &amp;amp; -$substr(Y,X)  =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
Put, say &amp;lt;i&amp;gt;{ &amp;quot;max_answers&amp;quot;: 3}&amp;lt;/i&amp;gt; to the strategy box, to get more answers than one.&lt;br /&gt;
&lt;br /&gt;
Here we took a small selection of data from one of the files and added a few rules. Notice the trick with the special builtin predicate &amp;lt;i&amp;gt;$substr(K,Z)&amp;lt;/i&amp;gt;: it treats the argument constants as strings and checks whether the first one is a substring of the second one. Thus the &amp;lt;i&amp;gt;-$substr(X,Y) &amp;amp; -$substr(Y,X)&amp;lt;/i&amp;gt; simply eliminates equal constants  to avoid answers like &amp;lt;i&amp;gt;$ans(&#039;yago:August_Vaga&#039;,&#039;yago:August_Vaga&#039;).&amp;lt;/i&amp;gt;. Alternatively, if we had used the quotation marks around person id-s, we could have used the rule&lt;br /&gt;
&lt;br /&gt;
  borninsameplace(X,Y) &amp;amp; X!=Y =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
instead.&lt;br /&gt;
&lt;br /&gt;
Next, a slightly more interesting example (use &amp;lt;i&amp;gt;{ &amp;quot;max_answers&amp;quot;: 6}&amp;lt;/i&amp;gt; or less):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  triple(&amp;quot;yago:Lake_Peipus&amp;quot;,&amp;quot;rdf:type&amp;quot;,	&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Veisjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  &lt;br /&gt;
  triple(&amp;quot;yago:Väike_Emajõgi&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Tänassilma_River&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Tarvastu_River&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Emajõgi&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Veisjärv&amp;quot;,&amp;quot;yago:flowsInto&amp;quot;,&amp;quot;yago:Õhne&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Õhne&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Emajõgi&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Lake_Peipus&amp;quot;).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,&amp;quot;yago:flowsInto&amp;quot;,Y) =&amp;gt; boattravel(X,Y).&lt;br /&gt;
  triple(X,&amp;quot;yago:flowsInto&amp;quot;,Y) =&amp;gt; boattravel(Y,X).&lt;br /&gt;
  &lt;br /&gt;
  boattravel(X,Y) &amp;amp; boattravel(Y,Z) =&amp;gt; boattravel(X,Z).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;) &amp;amp; triple(Z,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;) &amp;amp; boattravel(X,Y) &amp;amp; boattravel(Y,Z) &amp;amp; X!=Z =&amp;gt; laketolake(X,Z).&lt;br /&gt;
  laketolake(X,Y) =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
Interestingly, the Yago dataset uses two different id-s for Peipsi: &amp;lt;i&amp;gt;yago:Lake_Peipus&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;yago:Lake_Peipsi&amp;lt;/i&amp;gt; with several additional triplets indicating equality of these id-s to some other id-s, but not to each other! The related datasets for these id-s are also different. Conceptually, this is an errorish thingy in Yago.&lt;br /&gt;
&lt;br /&gt;
  yago:Lake_Peipsi	rdf:type	yago:Lake&lt;br /&gt;
  yago:Lake_Peipsi	owl:sameAs	wd:Q2627792&lt;br /&gt;
  yago:Lake_Peipsi	schema:sameAs	&amp;quot;/g/1217z1dh&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  yago:Lake_Peipus	rdf:type	yago:Lake&lt;br /&gt;
  yago:Lake_Peipus	owl:sameAs	wd:Q19253&lt;br /&gt;
  yago:Lake_Peipus	schema:sameAs	&amp;quot;/m/021yh2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Ideas for writing your own rules =&lt;br /&gt;
&lt;br /&gt;
The main recommendation is thinking what nontrivial things we could ask from the dataset and then looking whether it actually contains sufficient data for this. If you have an idea, try it out with small examples first.&lt;br /&gt;
&lt;br /&gt;
Try to combine different rules requiring the generation of longer nontrivial proofs for answers.&lt;br /&gt;
&lt;br /&gt;
Some ideas, including somewhat crazy ones:&lt;br /&gt;
&lt;br /&gt;
* Categorizing objects into larger categories, using the transivity of rdf:type (you have to write your own rule for the transitivity). &lt;br /&gt;
* What city/town/lake/island is inside what, according to located-in-estonia.txt. What can you derive from this, say, using transitivity of &amp;lt;i&amp;gt;inside&amp;lt;/i&amp;gt;?&lt;br /&gt;
* Who was born where and how could they potentially travel with the boat to a place another person was born :)&lt;br /&gt;
* Finding data from people-in-estonia.txt for persons active in created-in-estonia.txt. Finding people born nearby active in the same movies. Etc.&lt;br /&gt;
* Convert birth dates like &amp;lt;i&amp;gt;yago:Endel_Ruberg       schema:birthDate        &amp;quot;1917-05-21T00:00:00Z&amp;quot;^^xsd:dateTime&amp;lt;/i&amp;gt; to simple integers and use the built-in arithmetic of th e reasoner (see &amp;quot;About&amp;quot; -&amp;gt; &amp;quot;Special symbols and additional constructions&amp;quot; in logictools) to filter out suitable people. Who is surely not alive any more? Who are roughly of the same age and have something more in common?&lt;br /&gt;
* Converting triplets in the dataset &amp;lt;i&amp;gt;triple(a,b,c)&amp;lt;/i&amp;gt; where the first and second argument should conceptually strictly determine the third (like when c is a birthdate) to equalities like &amp;lt;i&amp;gt;b(a)=c&amp;lt;/i&amp;gt; instead and then using terms and equalities in your rules for such cases.&lt;br /&gt;
* Generating trips with actual paths shown in answers: you will need function term arguments in your predicates for this, see the example from the first lecture:&lt;br /&gt;
&lt;br /&gt;
  railroad(tallinn,tapa).&lt;br /&gt;
  railroad(tapa,tartu).&lt;br /&gt;
  highway(tallinn,virtsu).&lt;br /&gt;
  sealane(virtsu,kuivastu).&lt;br /&gt;
  highway(kuressaare,kuivastu).&lt;br /&gt;
  railroad(X,Y) =&amp;gt; railroad(Y,X).&lt;br /&gt;
  highway(X,Y) =&amp;gt; highway(Y,X).&lt;br /&gt;
  sealane(X,Y) =&amp;gt; sealane(Y,X).&lt;br /&gt;
  railroad(X,Y) =&amp;gt; easytravel(X,Y,use(train,X,Y)).&lt;br /&gt;
  highway(X,Y) =&amp;gt; easytravel(X,Y,use(bus,X,Y)).&lt;br /&gt;
  sealane(X,Y) =&amp;gt; easytravel(X,Y,use(ship,X,Y)).&lt;br /&gt;
  easytravel(X,Y,P1) &amp;amp; easytravel(Y,Z,P2) =&amp;gt; easytravel(X,Z,combine(P1,P2)).&lt;br /&gt;
  easytravel(tartu,X,Y) &amp;amp; spacity(X) =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
= Using large datasets: logictools vs command line reasoner gkc =&lt;br /&gt;
&lt;br /&gt;
Logictools is unable to eat very large datasets and the options to control it are limited. Also, experimenting only on the web may be cumbersome. &lt;br /&gt;
&lt;br /&gt;
Thus I&#039;d recommend to download the full-powered version of the reasoner used in logictools  from https://github.com/tammet/gkc : it is best to use the somewhat older release https://github.com/tammet/gkc/releases/tag/v0.6.0 which has the same codebase as logictools. Just take the provided windows, linux or macos binary: no need to compile yourself.&lt;br /&gt;
&lt;br /&gt;
A rather thorough tutorial of gkc with examples is README.md here: https://github.com/tammet/gkc/blob/master/Examples/README.md&lt;br /&gt;
&lt;br /&gt;
= Optional: additional datasets =&lt;br /&gt;
&lt;br /&gt;
In case you are adventurous, try to use additional datasets and combine these with the ones provided by Riina! For example, the Yago stuff contains triplets like&lt;br /&gt;
&lt;br /&gt;
  yago:Lake_Peipsi	owl:sameAs	wd:Q2627792 &lt;br /&gt;
&lt;br /&gt;
with the &amp;quot;wd:&amp;quot; defined above as &amp;quot;http://www.wikidata.org/entity/&amp;quot;, thus leading to pages like  http://www.wikidata.org/entity/Q2627792 . Now, looking at the source of this page, you find rows like &amp;lt;code&amp;gt;&amp;lt;link rel=&amp;quot;alternate&amp;quot; href=&amp;quot;https://www.wikidata.org/wiki/Special:EntityData/Q2627792.nt&amp;quot; type=&amp;quot;application/n-triples&amp;quot;&amp;gt;&amp;lt;/code&amp;gt; with the link &lt;br /&gt;
https://www.wikidata.org/wiki/Special:EntityData/Q2627792.nt leading to a large set of triplets related to Lake Peipsi! Most of these represent some specific complex encodings of this wikidata web page itself, but several are actually about Peipsi.&lt;br /&gt;
&lt;br /&gt;
A list of well-known and used large &amp;quot;generic&amp;quot; fact and knowledge bases can be found in http://lambda.ee/wiki/Teadmiste_formaliseerimine#Block_3:_General-knowledge_databases . You may want to have a look at these, but beware: obviously it takes time to understand and process. Another cool source is [https://www.kaggle.com/datasets kaggle.]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=KR_2025_homework_part_1&amp;diff=22010</id>
		<title>KR 2025 homework part 1</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=KR_2025_homework_part_1&amp;diff=22010"/>
		<updated>2025-02-18T14:35:13Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* LLM generated data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You will have to write a small program to convert/filter data to a suitable format for experimenting with a logical reasoner, and then write ca 10 nontrivial rules for answering questions. Add some facts using LLM.&lt;br /&gt;
&lt;br /&gt;
Finally, experiment with the reasoner on this data + rules and make a small presentation of your data, rules, successes and failures. &lt;br /&gt;
&lt;br /&gt;
The presentation does not have to be made with special slides and a long writeup (although this is also OK). You are expected to show the data, rules and results and briefly explain your ideas, experiments and the work process. Just using an editor for showing this stuff is OK. Best if you can also make a small demo with the reasoner actually running and proving some of the queries.&lt;br /&gt;
&lt;br /&gt;
Not everything you try out needs to work: some failures are also interesting.&lt;br /&gt;
&lt;br /&gt;
We award a few extra points for adventurous people adding extra data into the fray; see the last section about optional stuff.&lt;br /&gt;
&lt;br /&gt;
= Data =&lt;br /&gt;
&lt;br /&gt;
Riina took the large datasets from https://yago-knowledge.org/ and prepared relatively small selections (all about something Estonian) from this data. The link to the files is [https://cs.taltech.ee/staff/riina.maigre/iti8700/lab1/ here]. The data is presented as plain triplets, no fancy encoding (except namespaces) is involved.&lt;br /&gt;
&lt;br /&gt;
This set of files also contains an estonian_taxonomy.txt file, which is a subset of yago-taxonomy.txt. Using some parts of estonian_taxonomy.txt file might help to write more complex rules.&lt;br /&gt;
&lt;br /&gt;
Suggested topics are tourism and entertainment/culture. But you can choose any other topic.&lt;br /&gt;
&lt;br /&gt;
First, please download the files and explore them a bit. Then convert the files to the format our reasoner gk (or its web version http://logictools.org) can eat. Write a program for this! Trying to just replace/filter stuff using an editor will become very cumbersome soon.&lt;br /&gt;
&lt;br /&gt;
For example, the triplet&lt;br /&gt;
    yago:Lake_Peipsi	rdf:type	yago:Lake&lt;br /&gt;
can be converted to&lt;br /&gt;
    triple(yago:Lake_Peipsi,rdf:type,yago:Lake).&lt;br /&gt;
or with the quotation marks&lt;br /&gt;
    triple(&amp;quot;yago:Lake_Peipsi&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Notice that I have not bothered to replace the abbreviations of namespaces like &amp;lt;i&amp;gt;yago&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;rdf&amp;lt;/i&amp;gt; etc with full names &amp;lt;i&amp;gt;http://yago-knowledge.org/resource/&amp;lt;/i&amp;gt; and &lt;br /&gt;
&amp;lt;i&amp;gt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;lt;/i&amp;gt;: the abbreviations make the symbols unique enough for our purposes.&lt;br /&gt;
&lt;br /&gt;
The predicate &amp;lt;i&amp;gt;triple&amp;lt;/i&amp;gt; is really arbitrary: you may use any name you like. You may also use the fourth argument for type, if you wish (like &amp;quot;string&amp;quot;/&amp;quot;integer&amp;quot;/&amp;quot;id&amp;quot;, in case it helps). Importantly, there are subtle differences between writing constants like &amp;lt;i&amp;gt;yago:Lake_Peipsi&amp;lt;/i&amp;gt; with or without quotation marks:&lt;br /&gt;
* Without quotation the reasoner does not assume that two different constants necessarily mean different objects. Saying &amp;lt;i&amp;gt;yago:Lake_Peipsi = yago:Lake_Peipus&amp;lt;/i&amp;gt; does not lead to a contradiction. Also, non-ascii symbols are generally not ok for non-quoted constants.&lt;br /&gt;
* Quotation marks make the reasoner to treat constants as strings, and thus &amp;lt;i&amp;gt;&amp;quot;yago:Lake_Peipsi&amp;quot; = &amp;quot;yago:Lake_Peipus&amp;quot;&amp;lt;/i&amp;gt; is a contradiction. Also, non-ascii symbols are OK.&lt;br /&gt;
&lt;br /&gt;
Observe that the datasets contain a huge amount of labels (i.e. human names) and comments in different languages, like&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@sh      .&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@lfn     .&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@es      .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Tartu&amp;quot;@ko      .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Tartu&amp;quot;@mhr     .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Jurjev&amp;quot;@cs     .&lt;br /&gt;
  yago:Tartu_Art_House	rdfs:comment	&amp;quot;museum di Estonia&amp;quot;@id	.&lt;br /&gt;
  yago:Tartu_Art_House	rdfs:comment	&amp;quot;Museum in Estland&amp;quot;@de	.&lt;br /&gt;
&lt;br /&gt;
You may safely remove all the comments and most (or all) names, except these which you really use in your questions and rules, if any. For example, you may want to keep just one &amp;lt;i&amp;gt;rdfs:label&amp;lt;/i&amp;gt; for an object, without indicating a language (the @-stuff) at all.&lt;br /&gt;
&lt;br /&gt;
= LLM generated data =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ideas for adding additional facts sightseeing objects, what is close to what etc for tourism and facts about actors or musicians etc for entertainment/culture.&lt;br /&gt;
&lt;br /&gt;
You can either ask for facts formatted in RDF triples and convert them into logic. Or you can ask facts in logic. Experiment what works best!&lt;br /&gt;
&lt;br /&gt;
You can use any LLM chat or API. For API usage there are some almost free options.&lt;br /&gt;
&lt;br /&gt;
* [https://together.ai together.ai], that allows you to use open source LLMs for a small fee. As a new user you will get 25$ credit, which will last for a long time using cheaper models (see [https://www.together.ai/pricing https://www.together.ai/pricing]). Two of their models are available for free: Llama-3.3-70B-Instruct-Turbo-Free and DeepSeek-R1-Distill-Llama-70B-free.&lt;br /&gt;
&lt;br /&gt;
* [https://mistral.ai/ mistral.ai], you can try API for free (150.00€/month limit), in exchange your API requests may be used to improve their services.&lt;br /&gt;
&lt;br /&gt;
= Rules and questions =&lt;br /&gt;
&lt;br /&gt;
The best way to try out rules and questions is to use http://logictools.org for quick experiments along with small selections of data. For example, try&lt;br /&gt;
&lt;br /&gt;
  triple(&amp;quot;yago:Lake_Peipsi&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(X,Y,&amp;quot;yago:Lake&amp;quot;) =&amp;gt; $ans(X).&lt;br /&gt;
&lt;br /&gt;
and you should get a single answer along with the trivial proof. To get more answers, click the &amp;quot;Advanced&amp;quot; button and copy { &amp;quot;max_answers&amp;quot;: 2} into the strategy box. Beware that in case you ask for more answers than there really are, the reasoner may just keeping looking for more, eventually timeouting, and not giving any answers at all.&lt;br /&gt;
&lt;br /&gt;
Now let us try out something simple, but not totally trivial:&lt;br /&gt;
&lt;br /&gt;
  triple(yago:Jaan_Lepp,	schema:birthPlace,      yago:Anija_Parish).&lt;br /&gt;
  triple(yago:August_Vaga,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  triple(yago:Silvi_Vrait,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  triple(yago:Karmen_Pedaru,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,schema:birthPlace,Z) =&amp;gt; bornin(X,K).&lt;br /&gt;
  &lt;br /&gt;
  bornin(X,Z) &amp;amp; bornin(Y,Z) =&amp;gt; borninsameplace(X,Y).&lt;br /&gt;
  &lt;br /&gt;
  borninsameplace(X,Y) &amp;amp; -$substr(X,Y) &amp;amp; -$substr(Y,X)  =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
Put, say &amp;lt;i&amp;gt;{ &amp;quot;max_answers&amp;quot;: 3}&amp;lt;/i&amp;gt; to the strategy box, to get more answers than one.&lt;br /&gt;
&lt;br /&gt;
Here we took a small selection of data from one of the files and added a few rules. Notice the trick with the special builtin predicate &amp;lt;i&amp;gt;$substr(K,Z)&amp;lt;/i&amp;gt;: it treats the argument constants as strings and checks whether the first one is a substring of the second one. Thus the &amp;lt;i&amp;gt;-$substr(X,Y) &amp;amp; -$substr(Y,X)&amp;lt;/i&amp;gt; simply eliminates equal constants  to avoid answers like &amp;lt;i&amp;gt;$ans(&#039;yago:August_Vaga&#039;,&#039;yago:August_Vaga&#039;).&amp;lt;/i&amp;gt;. Alternatively, if we had used the quotation marks around person id-s, we could have used the rule&lt;br /&gt;
&lt;br /&gt;
  borninsameplace(X,Y) &amp;amp; X!=Y =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
instead.&lt;br /&gt;
&lt;br /&gt;
Next, a slightly more interesting example (use &amp;lt;i&amp;gt;{ &amp;quot;max_answers&amp;quot;: 6}&amp;lt;/i&amp;gt; or less):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  triple(&amp;quot;yago:Lake_Peipus&amp;quot;,&amp;quot;rdf:type&amp;quot;,	&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Veisjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  &lt;br /&gt;
  triple(&amp;quot;yago:Väike_Emajõgi&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Tänassilma_River&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Tarvastu_River&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Emajõgi&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Veisjärv&amp;quot;,&amp;quot;yago:flowsInto&amp;quot;,&amp;quot;yago:Õhne&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Õhne&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Emajõgi&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Lake_Peipus&amp;quot;).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,&amp;quot;yago:flowsInto&amp;quot;,Y) =&amp;gt; boattravel(X,Y).&lt;br /&gt;
  triple(X,&amp;quot;yago:flowsInto&amp;quot;,Y) =&amp;gt; boattravel(Y,X).&lt;br /&gt;
  &lt;br /&gt;
  boattravel(X,Y) &amp;amp; boattravel(Y,Z) =&amp;gt; boattravel(X,Z).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;) &amp;amp; triple(Z,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;) &amp;amp; boattravel(X,Y) &amp;amp; boattravel(Y,Z) &amp;amp; X!=Z =&amp;gt; laketolake(X,Z).&lt;br /&gt;
  laketolake(X,Y) =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
Interestingly, the Yago dataset uses two different id-s for Peipsi: &amp;lt;i&amp;gt;yago:Lake_Peipus&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;yago:Lake_Peipsi&amp;lt;/i&amp;gt; with several additional triplets indicating equality of these id-s to some other id-s, but not to each other! The related datasets for these id-s are also different. Conceptually, this is an errorish thingy in Yago.&lt;br /&gt;
&lt;br /&gt;
  yago:Lake_Peipsi	rdf:type	yago:Lake&lt;br /&gt;
  yago:Lake_Peipsi	owl:sameAs	wd:Q2627792&lt;br /&gt;
  yago:Lake_Peipsi	schema:sameAs	&amp;quot;/g/1217z1dh&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  yago:Lake_Peipus	rdf:type	yago:Lake&lt;br /&gt;
  yago:Lake_Peipus	owl:sameAs	wd:Q19253&lt;br /&gt;
  yago:Lake_Peipus	schema:sameAs	&amp;quot;/m/021yh2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Ideas for writing your own rules =&lt;br /&gt;
&lt;br /&gt;
The main recommendation is thinking what nontrivial things we could ask from the dataset and then looking whether it actually contains sufficient data for this. If you have an idea, try it out with small examples first.&lt;br /&gt;
&lt;br /&gt;
Try to combine different rules requiring the generation of longer nontrivial proofs for answers.&lt;br /&gt;
&lt;br /&gt;
Some ideas, including somewhat crazy ones:&lt;br /&gt;
&lt;br /&gt;
* Categorizing objects into larger categories, using the transivity of rdf:type (you have to write your own rule for the transitivity). &lt;br /&gt;
* What city/town/lake/island is inside what, according to located-in-estonia.txt. What can you derive from this, say, using transitivity of &amp;lt;i&amp;gt;inside&amp;lt;/i&amp;gt;?&lt;br /&gt;
* Who was born where and how could they potentially travel with the boat to a place another person was born :)&lt;br /&gt;
* Finding data from people-in-estonia.txt for persons active in created-in-estonia.txt. Finding people born nearby active in the same movies. Etc.&lt;br /&gt;
* Convert birth dates like &amp;lt;i&amp;gt;yago:Endel_Ruberg       schema:birthDate        &amp;quot;1917-05-21T00:00:00Z&amp;quot;^^xsd:dateTime&amp;lt;/i&amp;gt; to simple integers and use the built-in arithmetic of th e reasoner (see &amp;quot;About&amp;quot; -&amp;gt; &amp;quot;Special symbols and additional constructions&amp;quot; in logictools) to filter out suitable people. Who is surely not alive any more? Who are roughly of the same age and have something more in common?&lt;br /&gt;
* Converting triplets in the dataset &amp;lt;i&amp;gt;triple(a,b,c)&amp;lt;/i&amp;gt; where the first and second argument should conceptually strictly determine the third (like when c is a birthdate) to equalities like &amp;lt;i&amp;gt;b(a)=c&amp;lt;/i&amp;gt; instead and then using terms and equalities in your rules for such cases.&lt;br /&gt;
* Generating trips with actual paths shown in answers: you will need function term arguments in your predicates for this, see the example from the first lecture:&lt;br /&gt;
&lt;br /&gt;
  railroad(tallinn,tapa).&lt;br /&gt;
  railroad(tapa,tartu).&lt;br /&gt;
  highway(tallinn,virtsu).&lt;br /&gt;
  sealane(virtsu,kuivastu).&lt;br /&gt;
  highway(kuressaare,kuivastu).&lt;br /&gt;
  railroad(X,Y) =&amp;gt; railroad(Y,X).&lt;br /&gt;
  highway(X,Y) =&amp;gt; highway(Y,X).&lt;br /&gt;
  sealane(X,Y) =&amp;gt; sealane(Y,X).&lt;br /&gt;
  railroad(X,Y) =&amp;gt; easytravel(X,Y,use(train,X,Y)).&lt;br /&gt;
  highway(X,Y) =&amp;gt; easytravel(X,Y,use(bus,X,Y)).&lt;br /&gt;
  sealane(X,Y) =&amp;gt; easytravel(X,Y,use(ship,X,Y)).&lt;br /&gt;
  easytravel(X,Y,P1) &amp;amp; easytravel(Y,Z,P2) =&amp;gt; easytravel(X,Z,combine(P1,P2)).&lt;br /&gt;
  easytravel(tartu,X,Y) &amp;amp; spacity(X) =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
= Using large datasets: logictools vs command line reasoner gkc =&lt;br /&gt;
&lt;br /&gt;
Logictools is unable to eat very large datasets and the options to control it are limited. Also, experimenting only on the web may be cumbersome. &lt;br /&gt;
&lt;br /&gt;
Thus I&#039;d recommend to download the full-powered version of the reasoner used in logictools  from https://github.com/tammet/gkc : it is best to use the somewhat older release https://github.com/tammet/gkc/releases/tag/v0.6.0 which has the same codebase as logictools. Just take the provided windows, linux or macos binary: no need to compile yourself.&lt;br /&gt;
&lt;br /&gt;
A rather thorough tutorial of gkc with examples is README.md here: https://github.com/tammet/gkc/blob/master/Examples/README.md&lt;br /&gt;
&lt;br /&gt;
= Optional: additional datasets =&lt;br /&gt;
&lt;br /&gt;
In case you are adventurous, try to use additional datasets and combine these with the ones provided by Riina! For example, the Yago stuff contains triplets like&lt;br /&gt;
&lt;br /&gt;
  yago:Lake_Peipsi	owl:sameAs	wd:Q2627792 &lt;br /&gt;
&lt;br /&gt;
with the &amp;quot;wd:&amp;quot; defined above as &amp;quot;http://www.wikidata.org/entity/&amp;quot;, thus leading to pages like  http://www.wikidata.org/entity/Q2627792 . Now, looking at the source of this page, you find rows like &amp;lt;code&amp;gt;&amp;lt;link rel=&amp;quot;alternate&amp;quot; href=&amp;quot;https://www.wikidata.org/wiki/Special:EntityData/Q2627792.nt&amp;quot; type=&amp;quot;application/n-triples&amp;quot;&amp;gt;&amp;lt;/code&amp;gt; with the link &lt;br /&gt;
https://www.wikidata.org/wiki/Special:EntityData/Q2627792.nt leading to a large set of triplets related to Lake Peipsi! Most of these represent some specific complex encodings of this wikidata web page itself, but several are actually about Peipsi.&lt;br /&gt;
&lt;br /&gt;
A list of well-known and used large &amp;quot;generic&amp;quot; fact and knowledge bases can be found in http://lambda.ee/wiki/Teadmiste_formaliseerimine#Block_3:_General-knowledge_databases . You may want to have a look at these, but beware: obviously it takes time to understand and process. Another cool source is [https://www.kaggle.com/datasets kaggle.]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=KR_2025_homework_part_1&amp;diff=21972</id>
		<title>KR 2025 homework part 1</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=KR_2025_homework_part_1&amp;diff=21972"/>
		<updated>2025-02-17T11:00:13Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You will have to write a small program to convert/filter data to a suitable format for experimenting with a logical reasoner, and then write ca 10 nontrivial rules for answering questions. Add some facts using LLM.&lt;br /&gt;
&lt;br /&gt;
Finally, experiment with the reasoner on this data + rules and make a small presentation of your data, rules, successes and failures. &lt;br /&gt;
&lt;br /&gt;
The presentation does not have to be made with special slides and a long writeup (although this is also OK). You are expected to show the data, rules and results and briefly explain your ideas, experiments and the work process. Just using an editor for showing this stuff is OK. Best if you can also make a small demo with the reasoner actually running and proving some of the queries.&lt;br /&gt;
&lt;br /&gt;
Not everything you try out needs to work: some failures are also interesting.&lt;br /&gt;
&lt;br /&gt;
We award a few extra points for adventurous people adding extra data into the fray; see the last section about optional stuff.&lt;br /&gt;
&lt;br /&gt;
= Data =&lt;br /&gt;
&lt;br /&gt;
Riina took the large datasets from https://yago-knowledge.org/ and prepared relatively small selections (all about something Estonian) from this data. The link to the files is [https://cs.taltech.ee/staff/riina.maigre/iti8700/lab1/ here]. The data is presented as plain triplets, no fancy encoding (except namespaces) is involved.&lt;br /&gt;
&lt;br /&gt;
This set of files also contains an estonian_taxonomy.txt file, which is a subset of yago-taxonomy.txt. Using some parts of estonian_taxonomy.txt file might help to write more complex rules.&lt;br /&gt;
&lt;br /&gt;
Suggested topics are tourism and entertainment/culture. But you can choose any other topic.&lt;br /&gt;
&lt;br /&gt;
First, please download the files and explore them a bit. Then convert the files to the format our reasoner gk (or its web version http://logictools.org) can eat. Write a program for this! Trying to just replace/filter stuff using an editor will become very cumbersome soon.&lt;br /&gt;
&lt;br /&gt;
For example, the triplet&lt;br /&gt;
    yago:Lake_Peipsi	rdf:type	yago:Lake&lt;br /&gt;
can be converted to&lt;br /&gt;
    triple(yago:Lake_Peipsi,rdf:type,yago:Lake).&lt;br /&gt;
or with the quotation marks&lt;br /&gt;
    triple(&amp;quot;yago:Lake_Peipsi&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Notice that I have not bothered to replace the abbreviations of namespaces like &amp;lt;i&amp;gt;yago&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;rdf&amp;lt;/i&amp;gt; etc with full names &amp;lt;i&amp;gt;http://yago-knowledge.org/resource/&amp;lt;/i&amp;gt; and &lt;br /&gt;
&amp;lt;i&amp;gt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;lt;/i&amp;gt;: the abbreviations make the symbols unique enough for our purposes.&lt;br /&gt;
&lt;br /&gt;
The predicate &amp;lt;i&amp;gt;triple&amp;lt;/i&amp;gt; is really arbitrary: you may use any name you like. You may also use the fourth argument for type, if you wish (like &amp;quot;string&amp;quot;/&amp;quot;integer&amp;quot;/&amp;quot;id&amp;quot;, in case it helps). Importantly, there are subtle differences between writing constants like &amp;lt;i&amp;gt;yago:Lake_Peipsi&amp;lt;/i&amp;gt; with or without quotation marks:&lt;br /&gt;
* Without quotation the reasoner does not assume that two different constants necessarily mean different objects. Saying &amp;lt;i&amp;gt;yago:Lake_Peipsi = yago:Lake_Peipus&amp;lt;/i&amp;gt; does not lead to a contradiction. Also, non-ascii symbols are generally not ok for non-quoted constants.&lt;br /&gt;
* Quotation marks make the reasoner to treat constants as strings, and thus &amp;lt;i&amp;gt;&amp;quot;yago:Lake_Peipsi&amp;quot; = &amp;quot;yago:Lake_Peipus&amp;quot;&amp;lt;/i&amp;gt; is a contradiction. Also, non-ascii symbols are OK.&lt;br /&gt;
&lt;br /&gt;
Observe that the datasets contain a huge amount of labels (i.e. human names) and comments in different languages, like&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@sh      .&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@lfn     .&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@es      .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Tartu&amp;quot;@ko      .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Tartu&amp;quot;@mhr     .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Jurjev&amp;quot;@cs     .&lt;br /&gt;
  yago:Tartu_Art_House	rdfs:comment	&amp;quot;museum di Estonia&amp;quot;@id	.&lt;br /&gt;
  yago:Tartu_Art_House	rdfs:comment	&amp;quot;Museum in Estland&amp;quot;@de	.&lt;br /&gt;
&lt;br /&gt;
You may safely remove all the comments and most (or all) names, except these which you really use in your questions and rules, if any. For example, you may want to keep just one &amp;lt;i&amp;gt;rdfs:label&amp;lt;/i&amp;gt; for an object, without indicating a language (the @-stuff) at all.&lt;br /&gt;
&lt;br /&gt;
= LLM generated data =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ideas for adding additional facts sightseeing objects, what is close to what etc for tourism and facts about actors or musicians etc for entertainment/culture.&lt;br /&gt;
&lt;br /&gt;
You can either ask for facts formatted in RDF triples and convert them into logic. Or you can ask facts in logic. Experiment what works best!&lt;br /&gt;
&lt;br /&gt;
You can use any LLM chat or API. For API usage we suggest using [https://together.ai together.ai], that allows you to use open source LLMs for a small fee. As a new user you will get 25$ credit, which will last for a long time using cheaper models (see [https://www.together.ai/pricing https://www.together.ai/pricing]). Two of their models are available for free: Llama-3.3-70B-Instruct-Turbo-Free and DeepSeek-R1-Distill-Llama-70B-free.&lt;br /&gt;
&lt;br /&gt;
= Rules and questions =&lt;br /&gt;
&lt;br /&gt;
The best way to try out rules and questions is to use http://logictools.org for quick experiments along with small selections of data. For example, try&lt;br /&gt;
&lt;br /&gt;
  triple(&amp;quot;yago:Lake_Peipsi&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(X,Y,&amp;quot;yago:Lake&amp;quot;) =&amp;gt; $ans(X).&lt;br /&gt;
&lt;br /&gt;
and you should get a single answer along with the trivial proof. To get more answers, click the &amp;quot;Advanced&amp;quot; button and copy { &amp;quot;max_answers&amp;quot;: 2} into the strategy box. Beware that in case you ask for more answers than there really are, the reasoner may just keeping looking for more, eventually timeouting, and not giving any answers at all.&lt;br /&gt;
&lt;br /&gt;
Now let us try out something simple, but not totally trivial:&lt;br /&gt;
&lt;br /&gt;
  triple(yago:Jaan_Lepp,	schema:birthPlace,      yago:Anija_Parish).&lt;br /&gt;
  triple(yago:August_Vaga,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  triple(yago:Silvi_Vrait,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  triple(yago:Karmen_Pedaru,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,schema:birthPlace,Z) =&amp;gt; bornin(X,K).&lt;br /&gt;
  &lt;br /&gt;
  bornin(X,Z) &amp;amp; bornin(Y,Z) =&amp;gt; borninsameplace(X,Y).&lt;br /&gt;
  &lt;br /&gt;
  borninsameplace(X,Y) &amp;amp; -$substr(X,Y) &amp;amp; -$substr(Y,X)  =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
Put, say &amp;lt;i&amp;gt;{ &amp;quot;max_answers&amp;quot;: 3}&amp;lt;/i&amp;gt; to the strategy box, to get more answers than one.&lt;br /&gt;
&lt;br /&gt;
Here we took a small selection of data from one of the files and added a few rules. Notice the trick with the special builtin predicate &amp;lt;i&amp;gt;$substr(K,Z)&amp;lt;/i&amp;gt;: it treats the argument constants as strings and checks whether the first one is a substring of the second one. Thus the &amp;lt;i&amp;gt;-$substr(X,Y) &amp;amp; -$substr(Y,X)&amp;lt;/i&amp;gt; simply eliminates equal constants  to avoid answers like &amp;lt;i&amp;gt;$ans(&#039;yago:August_Vaga&#039;,&#039;yago:August_Vaga&#039;).&amp;lt;/i&amp;gt;. Alternatively, if we had used the quotation marks around person id-s, we could have used the rule&lt;br /&gt;
&lt;br /&gt;
  borninsameplace(X,Y) &amp;amp; X!=Y =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
instead.&lt;br /&gt;
&lt;br /&gt;
Next, a slightly more interesting example (use &amp;lt;i&amp;gt;{ &amp;quot;max_answers&amp;quot;: 6}&amp;lt;/i&amp;gt; or less):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  triple(&amp;quot;yago:Lake_Peipus&amp;quot;,&amp;quot;rdf:type&amp;quot;,	&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Veisjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  &lt;br /&gt;
  triple(&amp;quot;yago:Väike_Emajõgi&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Tänassilma_River&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Tarvastu_River&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Emajõgi&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Veisjärv&amp;quot;,&amp;quot;yago:flowsInto&amp;quot;,&amp;quot;yago:Õhne&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Õhne&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Emajõgi&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Lake_Peipus&amp;quot;).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,&amp;quot;yago:flowsInto&amp;quot;,Y) =&amp;gt; boattravel(X,Y).&lt;br /&gt;
  triple(X,&amp;quot;yago:flowsInto&amp;quot;,Y) =&amp;gt; boattravel(Y,X).&lt;br /&gt;
  &lt;br /&gt;
  boattravel(X,Y) &amp;amp; boattravel(Y,Z) =&amp;gt; boattravel(X,Z).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;) &amp;amp; triple(Z,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;) &amp;amp; boattravel(X,Y) &amp;amp; boattravel(Y,Z) &amp;amp; X!=Z =&amp;gt; laketolake(X,Z).&lt;br /&gt;
  laketolake(X,Y) =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
Interestingly, the Yago dataset uses two different id-s for Peipsi: &amp;lt;i&amp;gt;yago:Lake_Peipus&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;yago:Lake_Peipsi&amp;lt;/i&amp;gt; with several additional triplets indicating equality of these id-s to some other id-s, but not to each other! The related datasets for these id-s are also different. Conceptually, this is an errorish thingy in Yago.&lt;br /&gt;
&lt;br /&gt;
  yago:Lake_Peipsi	rdf:type	yago:Lake&lt;br /&gt;
  yago:Lake_Peipsi	owl:sameAs	wd:Q2627792&lt;br /&gt;
  yago:Lake_Peipsi	schema:sameAs	&amp;quot;/g/1217z1dh&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  yago:Lake_Peipus	rdf:type	yago:Lake&lt;br /&gt;
  yago:Lake_Peipus	owl:sameAs	wd:Q19253&lt;br /&gt;
  yago:Lake_Peipus	schema:sameAs	&amp;quot;/m/021yh2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Ideas for writing your own rules =&lt;br /&gt;
&lt;br /&gt;
The main recommendation is thinking what nontrivial things we could ask from the dataset and then looking whether it actually contains sufficient data for this. If you have an idea, try it out with small examples first.&lt;br /&gt;
&lt;br /&gt;
Try to combine different rules requiring the generation of longer nontrivial proofs for answers.&lt;br /&gt;
&lt;br /&gt;
Some ideas, including somewhat crazy ones:&lt;br /&gt;
&lt;br /&gt;
* Categorizing objects into larger categories, using the transivity of rdf:type (you have to write your own rule for the transitivity). &lt;br /&gt;
* What city/town/lake/island is inside what, according to located-in-estonia.txt. What can you derive from this, say, using transitivity of &amp;lt;i&amp;gt;inside&amp;lt;/i&amp;gt;?&lt;br /&gt;
* Who was born where and how could they potentially travel with the boat to a place another person was born :)&lt;br /&gt;
* Finding data from people-in-estonia.txt for persons active in created-in-estonia.txt. Finding people born nearby active in the same movies. Etc.&lt;br /&gt;
* Convert birth dates like &amp;lt;i&amp;gt;yago:Endel_Ruberg       schema:birthDate        &amp;quot;1917-05-21T00:00:00Z&amp;quot;^^xsd:dateTime&amp;lt;/i&amp;gt; to simple integers and use the built-in arithmetic of th e reasoner (see &amp;quot;About&amp;quot; -&amp;gt; &amp;quot;Special symbols and additional constructions&amp;quot; in logictools) to filter out suitable people. Who is surely not alive any more? Who are roughly of the same age and have something more in common?&lt;br /&gt;
* Converting triplets in the dataset &amp;lt;i&amp;gt;triple(a,b,c)&amp;lt;/i&amp;gt; where the first and second argument should conceptually strictly determine the third (like when c is a birthdate) to equalities like &amp;lt;i&amp;gt;b(a)=c&amp;lt;/i&amp;gt; instead and then using terms and equalities in your rules for such cases.&lt;br /&gt;
* Generating trips with actual paths shown in answers: you will need function term arguments in your predicates for this, see the example from the first lecture:&lt;br /&gt;
&lt;br /&gt;
  railroad(tallinn,tapa).&lt;br /&gt;
  railroad(tapa,tartu).&lt;br /&gt;
  highway(tallinn,virtsu).&lt;br /&gt;
  sealane(virtsu,kuivastu).&lt;br /&gt;
  highway(kuressaare,kuivastu).&lt;br /&gt;
  railroad(X,Y) =&amp;gt; railroad(Y,X).&lt;br /&gt;
  highway(X,Y) =&amp;gt; highway(Y,X).&lt;br /&gt;
  sealane(X,Y) =&amp;gt; sealane(Y,X).&lt;br /&gt;
  railroad(X,Y) =&amp;gt; easytravel(X,Y,use(train,X,Y)).&lt;br /&gt;
  highway(X,Y) =&amp;gt; easytravel(X,Y,use(bus,X,Y)).&lt;br /&gt;
  sealane(X,Y) =&amp;gt; easytravel(X,Y,use(ship,X,Y)).&lt;br /&gt;
  easytravel(X,Y,P1) &amp;amp; easytravel(Y,Z,P2) =&amp;gt; easytravel(X,Z,combine(P1,P2)).&lt;br /&gt;
  easytravel(tartu,X,Y) &amp;amp; spacity(X) =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
= Using large datasets: logictools vs command line reasoner gkc =&lt;br /&gt;
&lt;br /&gt;
Logictools is unable to eat very large datasets and the options to control it are limited. Also, experimenting only on the web may be cumbersome. &lt;br /&gt;
&lt;br /&gt;
Thus I&#039;d recommend to download the full-powered version of the reasoner used in logictools  from https://github.com/tammet/gkc : it is best to use the somewhat older release https://github.com/tammet/gkc/releases/tag/v0.6.0 which has the same codebase as logictools. Just take the provided windows, linux or macos binary: no need to compile yourself.&lt;br /&gt;
&lt;br /&gt;
A rather thorough tutorial of gkc with examples is README.md here: https://github.com/tammet/gkc/blob/master/Examples/README.md&lt;br /&gt;
&lt;br /&gt;
= Optional: additional datasets =&lt;br /&gt;
&lt;br /&gt;
In case you are adventurous, try to use additional datasets and combine these with the ones provided by Riina! For example, the Yago stuff contains triplets like&lt;br /&gt;
&lt;br /&gt;
  yago:Lake_Peipsi	owl:sameAs	wd:Q2627792 &lt;br /&gt;
&lt;br /&gt;
with the &amp;quot;wd:&amp;quot; defined above as &amp;quot;http://www.wikidata.org/entity/&amp;quot;, thus leading to pages like  http://www.wikidata.org/entity/Q2627792 . Now, looking at the source of this page, you find rows like &amp;lt;code&amp;gt;&amp;lt;link rel=&amp;quot;alternate&amp;quot; href=&amp;quot;https://www.wikidata.org/wiki/Special:EntityData/Q2627792.nt&amp;quot; type=&amp;quot;application/n-triples&amp;quot;&amp;gt;&amp;lt;/code&amp;gt; with the link &lt;br /&gt;
https://www.wikidata.org/wiki/Special:EntityData/Q2627792.nt leading to a large set of triplets related to Lake Peipsi! Most of these represent some specific complex encodings of this wikidata web page itself, but several are actually about Peipsi.&lt;br /&gt;
&lt;br /&gt;
A list of well-known and used large &amp;quot;generic&amp;quot; fact and knowledge bases can be found in http://lambda.ee/wiki/Teadmiste_formaliseerimine#Block_3:_General-knowledge_databases . You may want to have a look at these, but beware: obviously it takes time to understand and process. Another cool source is [https://www.kaggle.com/datasets kaggle.]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=KR_2025_homework_part_1&amp;diff=21971</id>
		<title>KR 2025 homework part 1</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=KR_2025_homework_part_1&amp;diff=21971"/>
		<updated>2025-02-12T12:51:28Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* LLM generated data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You will have to write a small program to convert/filter data to a suitable format for experimenting with a logical reasoner, and then write ca 10 nontrivial rules for answering questions. Add some facts using LLM.&lt;br /&gt;
&lt;br /&gt;
Finally, experiment with the reasoner on this data + rules and make a small presentation of your data, rules, successes and failures. &lt;br /&gt;
&lt;br /&gt;
The presentation does not have to be made with special slides and a long writeup (although this is also OK). You are expected to show the data, rules and results and briefly explain your ideas, experiments and the work process. Just using an editor for showing this stuff is OK. Best if you can also make a small demo with the reasoner actually running and proving some of the queries.&lt;br /&gt;
&lt;br /&gt;
Not everything you try out needs to work: some failures are also interesting.&lt;br /&gt;
&lt;br /&gt;
We award a few extra points for adventurous people adding extra data into the fray; see the last section about optional stuff.&lt;br /&gt;
&lt;br /&gt;
= Data =&lt;br /&gt;
&lt;br /&gt;
Riina took the large datasets from https://yago-knowledge.org/ and prepared relatively small selections (all about something Estonian) from this data. The link to the files is [https://cs.taltech.ee/staff/riina.maigre/iti8700/lab1/ here]. The data is presented as plain triplets, no fancy encoding (except namespaces) is involved.&lt;br /&gt;
&lt;br /&gt;
This set of files also contains an estonian_taxonomy.txt file, which is a subset of yago-taxonomy.txt. Using all or part of estonian_taxonomy.txt file might help to write more complex rules.&lt;br /&gt;
&lt;br /&gt;
Suggested topics are tourism and entertainment/culture. But you can choose any other topic.&lt;br /&gt;
&lt;br /&gt;
First, please download the files and explore them a bit. Then convert the files to the format our reasoner gk (or its web version http://logictools.org) can eat. Write a program for this! Trying to just replace/filter stuff using an editor will become very cumbersome soon.&lt;br /&gt;
&lt;br /&gt;
For example, the triplet&lt;br /&gt;
    yago:Lake_Peipsi	rdf:type	yago:Lake&lt;br /&gt;
can be converted to&lt;br /&gt;
    triple(yago:Lake_Peipsi,rdf:type,yago:Lake).&lt;br /&gt;
or with the quotation marks&lt;br /&gt;
    triple(&amp;quot;yago:Lake_Peipsi&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Notice that I have not bothered to replace the abbreviations of namespaces like &amp;lt;i&amp;gt;yago&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;rdf&amp;lt;/i&amp;gt; etc with full names &amp;lt;i&amp;gt;http://yago-knowledge.org/resource/&amp;lt;/i&amp;gt; and &lt;br /&gt;
&amp;lt;i&amp;gt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;lt;/i&amp;gt;: the abbreviations make the symbols unique enough for our purposes.&lt;br /&gt;
&lt;br /&gt;
The predicate &amp;lt;i&amp;gt;triple&amp;lt;/i&amp;gt; is really arbitrary: you may use any name you like. You may also use the fourth argument for type, if you wish (like &amp;quot;string&amp;quot;/&amp;quot;integer&amp;quot;/&amp;quot;id&amp;quot;, in case it helps). Importantly, there are subtle differences between writing constants like &amp;lt;i&amp;gt;yago:Lake_Peipsi&amp;lt;/i&amp;gt; with or without quotation marks:&lt;br /&gt;
* Without quotation the reasoner does not assume that two different constants necessarily mean different objects. Saying &amp;lt;i&amp;gt;yago:Lake_Peipsi = yago:Lake_Peipus&amp;lt;/i&amp;gt; does not lead to a contradiction. Also, non-ascii symbols are generally not ok for non-quoted constants.&lt;br /&gt;
* Quotation marks make the reasoner to treat constants as strings, and thus &amp;lt;i&amp;gt;&amp;quot;yago:Lake_Peipsi&amp;quot; = &amp;quot;yago:Lake_Peipus&amp;quot;&amp;lt;/i&amp;gt; is a contradiction. Also, non-ascii symbols are OK.&lt;br /&gt;
&lt;br /&gt;
Observe that the datasets contain a huge amount of labels (i.e. human names) and comments in different languages, like&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@sh      .&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@lfn     .&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@es      .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Tartu&amp;quot;@ko      .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Tartu&amp;quot;@mhr     .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Jurjev&amp;quot;@cs     .&lt;br /&gt;
  yago:Tartu_Art_House	rdfs:comment	&amp;quot;museum di Estonia&amp;quot;@id	.&lt;br /&gt;
  yago:Tartu_Art_House	rdfs:comment	&amp;quot;Museum in Estland&amp;quot;@de	.&lt;br /&gt;
&lt;br /&gt;
You may safely remove all the comments and most (or all) names, except these which you really use in your questions and rules, if any. For example, you may want to keep just one &amp;lt;i&amp;gt;rdfs:label&amp;lt;/i&amp;gt; for an object, without indicating a language (the @-stuff) at all.&lt;br /&gt;
&lt;br /&gt;
= LLM generated data =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ideas for adding additional facts sightseeing objects, what is close to what etc for tourism and facts about actors or musicians etc for entertainment/culture.&lt;br /&gt;
&lt;br /&gt;
You can either ask for facts formatted in RDF triples and convert them into logic. Or you can ask facts in logic. Experiment what works best!&lt;br /&gt;
&lt;br /&gt;
You can use any LLM chat or API. For API usage we suggest using [https://together.ai together.ai], that allows you to use open source LLMs for a small fee. As a new user you will get 25$ credit, which will last for a long time using cheaper models (see [https://www.together.ai/pricing https://www.together.ai/pricing]). Two of their models are available for free: Llama-3.3-70B-Instruct-Turbo-Free and DeepSeek-R1-Distill-Llama-70B-free.&lt;br /&gt;
&lt;br /&gt;
= Rules and questions =&lt;br /&gt;
&lt;br /&gt;
The best way to try out rules and questions is to use http://logictools.org for quick experiments along with small selections of data. For example, try&lt;br /&gt;
&lt;br /&gt;
  triple(&amp;quot;yago:Lake_Peipsi&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(X,Y,&amp;quot;yago:Lake&amp;quot;) =&amp;gt; $ans(X).&lt;br /&gt;
&lt;br /&gt;
and you should get a single answer along with the trivial proof. To get more answers, click the &amp;quot;Advanced&amp;quot; button and copy { &amp;quot;max_answers&amp;quot;: 2} into the strategy box. Beware that in case you ask for more answers than there really are, the reasoner may just keeping looking for more, eventually timeouting, and not giving any answers at all.&lt;br /&gt;
&lt;br /&gt;
Now let us try out something simple, but not totally trivial:&lt;br /&gt;
&lt;br /&gt;
  triple(yago:Jaan_Lepp,	schema:birthPlace,      yago:Anija_Parish).&lt;br /&gt;
  triple(yago:August_Vaga,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  triple(yago:Silvi_Vrait,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  triple(yago:Karmen_Pedaru,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,schema:birthPlace,Z) =&amp;gt; bornin(X,K).&lt;br /&gt;
  &lt;br /&gt;
  bornin(X,Z) &amp;amp; bornin(Y,Z) =&amp;gt; borninsameplace(X,Y).&lt;br /&gt;
  &lt;br /&gt;
  borninsameplace(X,Y) &amp;amp; -$substr(X,Y) &amp;amp; -$substr(Y,X)  =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
Put, say &amp;lt;i&amp;gt;{ &amp;quot;max_answers&amp;quot;: 3}&amp;lt;/i&amp;gt; to the strategy box, to get more answers than one.&lt;br /&gt;
&lt;br /&gt;
Here we took a small selection of data from one of the files and added a few rules. Notice the trick with the special builtin predicate &amp;lt;i&amp;gt;$substr(K,Z)&amp;lt;/i&amp;gt;: it treats the argument constants as strings and checks whether the first one is a substring of the second one. Thus the &amp;lt;i&amp;gt;-$substr(X,Y) &amp;amp; -$substr(Y,X)&amp;lt;/i&amp;gt; simply eliminates equal constants  to avoid answers like &amp;lt;i&amp;gt;$ans(&#039;yago:August_Vaga&#039;,&#039;yago:August_Vaga&#039;).&amp;lt;/i&amp;gt;. Alternatively, if we had used the quotation marks around person id-s, we could have used the rule&lt;br /&gt;
&lt;br /&gt;
  borninsameplace(X,Y) &amp;amp; X!=Y =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
instead.&lt;br /&gt;
&lt;br /&gt;
Next, a slightly more interesting example (use &amp;lt;i&amp;gt;{ &amp;quot;max_answers&amp;quot;: 6}&amp;lt;/i&amp;gt; or less):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  triple(&amp;quot;yago:Lake_Peipus&amp;quot;,&amp;quot;rdf:type&amp;quot;,	&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Veisjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  &lt;br /&gt;
  triple(&amp;quot;yago:Väike_Emajõgi&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Tänassilma_River&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Tarvastu_River&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Emajõgi&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Veisjärv&amp;quot;,&amp;quot;yago:flowsInto&amp;quot;,&amp;quot;yago:Õhne&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Õhne&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Emajõgi&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Lake_Peipus&amp;quot;).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,&amp;quot;yago:flowsInto&amp;quot;,Y) =&amp;gt; boattravel(X,Y).&lt;br /&gt;
  triple(X,&amp;quot;yago:flowsInto&amp;quot;,Y) =&amp;gt; boattravel(Y,X).&lt;br /&gt;
  &lt;br /&gt;
  boattravel(X,Y) &amp;amp; boattravel(Y,Z) =&amp;gt; boattravel(X,Z).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;) &amp;amp; triple(Z,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;) &amp;amp; boattravel(X,Y) &amp;amp; boattravel(Y,Z) &amp;amp; X!=Z =&amp;gt; laketolake(X,Z).&lt;br /&gt;
  laketolake(X,Y) =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
Interestingly, the Yago dataset uses two different id-s for Peipsi: &amp;lt;i&amp;gt;yago:Lake_Peipus&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;yago:Lake_Peipsi&amp;lt;/i&amp;gt; with several additional triplets indicating equality of these id-s to some other id-s, but not to each other! The related datasets for these id-s are also different. Conceptually, this is an errorish thingy in Yago.&lt;br /&gt;
&lt;br /&gt;
  yago:Lake_Peipsi	rdf:type	yago:Lake&lt;br /&gt;
  yago:Lake_Peipsi	owl:sameAs	wd:Q2627792&lt;br /&gt;
  yago:Lake_Peipsi	schema:sameAs	&amp;quot;/g/1217z1dh&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  yago:Lake_Peipus	rdf:type	yago:Lake&lt;br /&gt;
  yago:Lake_Peipus	owl:sameAs	wd:Q19253&lt;br /&gt;
  yago:Lake_Peipus	schema:sameAs	&amp;quot;/m/021yh2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Ideas for writing your own rules =&lt;br /&gt;
&lt;br /&gt;
The main recommendation is thinking what nontrivial things we could ask from the dataset and then looking whether it actually contains sufficient data for this. If you have an idea, try it out with small examples first.&lt;br /&gt;
&lt;br /&gt;
Try to combine different rules requiring the generation of longer nontrivial proofs for answers.&lt;br /&gt;
&lt;br /&gt;
Some ideas, including somewhat crazy ones:&lt;br /&gt;
&lt;br /&gt;
* Categorizing objects into larger categories, using the transivity of rdf:type (you have to write your own rule for the transitivity). &lt;br /&gt;
* What city/town/lake/island is inside what, according to located-in-estonia.txt. What can you derive from this, say, using transitivity of &amp;lt;i&amp;gt;inside&amp;lt;/i&amp;gt;?&lt;br /&gt;
* Who was born where and how could they potentially travel with the boat to a place another person was born :)&lt;br /&gt;
* Finding data from people-in-estonia.txt for persons active in created-in-estonia.txt. Finding people born nearby active in the same movies. Etc.&lt;br /&gt;
* Convert birth dates like &amp;lt;i&amp;gt;yago:Endel_Ruberg       schema:birthDate        &amp;quot;1917-05-21T00:00:00Z&amp;quot;^^xsd:dateTime&amp;lt;/i&amp;gt; to simple integers and use the built-in arithmetic of th e reasoner (see &amp;quot;About&amp;quot; -&amp;gt; &amp;quot;Special symbols and additional constructions&amp;quot; in logictools) to filter out suitable people. Who is surely not alive any more? Who are roughly of the same age and have something more in common?&lt;br /&gt;
* Converting triplets in the dataset &amp;lt;i&amp;gt;triple(a,b,c)&amp;lt;/i&amp;gt; where the first and second argument should conceptually strictly determine the third (like when c is a birthdate) to equalities like &amp;lt;i&amp;gt;b(a)=c&amp;lt;/i&amp;gt; instead and then using terms and equalities in your rules for such cases.&lt;br /&gt;
* Generating trips with actual paths shown in answers: you will need function term arguments in your predicates for this, see the example from the first lecture:&lt;br /&gt;
&lt;br /&gt;
  railroad(tallinn,tapa).&lt;br /&gt;
  railroad(tapa,tartu).&lt;br /&gt;
  highway(tallinn,virtsu).&lt;br /&gt;
  sealane(virtsu,kuivastu).&lt;br /&gt;
  highway(kuressaare,kuivastu).&lt;br /&gt;
  railroad(X,Y) =&amp;gt; railroad(Y,X).&lt;br /&gt;
  highway(X,Y) =&amp;gt; highway(Y,X).&lt;br /&gt;
  sealane(X,Y) =&amp;gt; sealane(Y,X).&lt;br /&gt;
  railroad(X,Y) =&amp;gt; easytravel(X,Y,use(train,X,Y)).&lt;br /&gt;
  highway(X,Y) =&amp;gt; easytravel(X,Y,use(bus,X,Y)).&lt;br /&gt;
  sealane(X,Y) =&amp;gt; easytravel(X,Y,use(ship,X,Y)).&lt;br /&gt;
  easytravel(X,Y,P1) &amp;amp; easytravel(Y,Z,P2) =&amp;gt; easytravel(X,Z,combine(P1,P2)).&lt;br /&gt;
  easytravel(tartu,X,Y) &amp;amp; spacity(X) =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
= Using large datasets: logictools vs command line reasoner gkc =&lt;br /&gt;
&lt;br /&gt;
Logictools is unable to eat very large datasets and the options to control it are limited. Also, experimenting only on the web may be cumbersome. &lt;br /&gt;
&lt;br /&gt;
Thus I&#039;d recommend to download the full-powered version of the reasoner used in logictools  from https://github.com/tammet/gkc : it is best to use the somewhat older release https://github.com/tammet/gkc/releases/tag/v0.6.0 which has the same codebase as logictools. Just take the provided windows, linux or macos binary: no need to compile yourself.&lt;br /&gt;
&lt;br /&gt;
A rather thorough tutorial of gkc with examples is README.md here: https://github.com/tammet/gkc/blob/master/Examples/README.md&lt;br /&gt;
&lt;br /&gt;
= Optional: additional datasets =&lt;br /&gt;
&lt;br /&gt;
In case you are adventurous, try to use additional datasets and combine these with the ones provided by Riina! For example, the Yago stuff contains triplets like&lt;br /&gt;
&lt;br /&gt;
  yago:Lake_Peipsi	owl:sameAs	wd:Q2627792 &lt;br /&gt;
&lt;br /&gt;
with the &amp;quot;wd:&amp;quot; defined above as &amp;quot;http://www.wikidata.org/entity/&amp;quot;, thus leading to pages like  http://www.wikidata.org/entity/Q2627792 . Now, looking at the source of this page, you find rows like &amp;lt;code&amp;gt;&amp;lt;link rel=&amp;quot;alternate&amp;quot; href=&amp;quot;https://www.wikidata.org/wiki/Special:EntityData/Q2627792.nt&amp;quot; type=&amp;quot;application/n-triples&amp;quot;&amp;gt;&amp;lt;/code&amp;gt; with the link &lt;br /&gt;
https://www.wikidata.org/wiki/Special:EntityData/Q2627792.nt leading to a large set of triplets related to Lake Peipsi! Most of these represent some specific complex encodings of this wikidata web page itself, but several are actually about Peipsi.&lt;br /&gt;
&lt;br /&gt;
A list of well-known and used large &amp;quot;generic&amp;quot; fact and knowledge bases can be found in http://lambda.ee/wiki/Teadmiste_formaliseerimine#Block_3:_General-knowledge_databases . You may want to have a look at these, but beware: obviously it takes time to understand and process. Another cool source is [https://www.kaggle.com/datasets kaggle.]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=KR_2025_homework_part_1&amp;diff=21970</id>
		<title>KR 2025 homework part 1</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=KR_2025_homework_part_1&amp;diff=21970"/>
		<updated>2025-02-12T12:42:46Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You will have to write a small program to convert/filter data to a suitable format for experimenting with a logical reasoner, and then write ca 10 nontrivial rules for answering questions. Add some facts using LLM.&lt;br /&gt;
&lt;br /&gt;
Finally, experiment with the reasoner on this data + rules and make a small presentation of your data, rules, successes and failures. &lt;br /&gt;
&lt;br /&gt;
The presentation does not have to be made with special slides and a long writeup (although this is also OK). You are expected to show the data, rules and results and briefly explain your ideas, experiments and the work process. Just using an editor for showing this stuff is OK. Best if you can also make a small demo with the reasoner actually running and proving some of the queries.&lt;br /&gt;
&lt;br /&gt;
Not everything you try out needs to work: some failures are also interesting.&lt;br /&gt;
&lt;br /&gt;
We award a few extra points for adventurous people adding extra data into the fray; see the last section about optional stuff.&lt;br /&gt;
&lt;br /&gt;
= Data =&lt;br /&gt;
&lt;br /&gt;
Riina took the large datasets from https://yago-knowledge.org/ and prepared relatively small selections (all about something Estonian) from this data. The link to the files is [https://cs.taltech.ee/staff/riina.maigre/iti8700/lab1/ here]. The data is presented as plain triplets, no fancy encoding (except namespaces) is involved.&lt;br /&gt;
&lt;br /&gt;
This set of files also contains an estonian_taxonomy.txt file, which is a subset of yago-taxonomy.txt. Using all or part of estonian_taxonomy.txt file might help to write more complex rules.&lt;br /&gt;
&lt;br /&gt;
Suggested topics are tourism and entertainment/culture. But you can choose any other topic.&lt;br /&gt;
&lt;br /&gt;
First, please download the files and explore them a bit. Then convert the files to the format our reasoner gk (or its web version http://logictools.org) can eat. Write a program for this! Trying to just replace/filter stuff using an editor will become very cumbersome soon.&lt;br /&gt;
&lt;br /&gt;
For example, the triplet&lt;br /&gt;
    yago:Lake_Peipsi	rdf:type	yago:Lake&lt;br /&gt;
can be converted to&lt;br /&gt;
    triple(yago:Lake_Peipsi,rdf:type,yago:Lake).&lt;br /&gt;
or with the quotation marks&lt;br /&gt;
    triple(&amp;quot;yago:Lake_Peipsi&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Notice that I have not bothered to replace the abbreviations of namespaces like &amp;lt;i&amp;gt;yago&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;rdf&amp;lt;/i&amp;gt; etc with full names &amp;lt;i&amp;gt;http://yago-knowledge.org/resource/&amp;lt;/i&amp;gt; and &lt;br /&gt;
&amp;lt;i&amp;gt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;lt;/i&amp;gt;: the abbreviations make the symbols unique enough for our purposes.&lt;br /&gt;
&lt;br /&gt;
The predicate &amp;lt;i&amp;gt;triple&amp;lt;/i&amp;gt; is really arbitrary: you may use any name you like. You may also use the fourth argument for type, if you wish (like &amp;quot;string&amp;quot;/&amp;quot;integer&amp;quot;/&amp;quot;id&amp;quot;, in case it helps). Importantly, there are subtle differences between writing constants like &amp;lt;i&amp;gt;yago:Lake_Peipsi&amp;lt;/i&amp;gt; with or without quotation marks:&lt;br /&gt;
* Without quotation the reasoner does not assume that two different constants necessarily mean different objects. Saying &amp;lt;i&amp;gt;yago:Lake_Peipsi = yago:Lake_Peipus&amp;lt;/i&amp;gt; does not lead to a contradiction. Also, non-ascii symbols are generally not ok for non-quoted constants.&lt;br /&gt;
* Quotation marks make the reasoner to treat constants as strings, and thus &amp;lt;i&amp;gt;&amp;quot;yago:Lake_Peipsi&amp;quot; = &amp;quot;yago:Lake_Peipus&amp;quot;&amp;lt;/i&amp;gt; is a contradiction. Also, non-ascii symbols are OK.&lt;br /&gt;
&lt;br /&gt;
Observe that the datasets contain a huge amount of labels (i.e. human names) and comments in different languages, like&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@sh      .&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@lfn     .&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@es      .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Tartu&amp;quot;@ko      .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Tartu&amp;quot;@mhr     .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Jurjev&amp;quot;@cs     .&lt;br /&gt;
  yago:Tartu_Art_House	rdfs:comment	&amp;quot;museum di Estonia&amp;quot;@id	.&lt;br /&gt;
  yago:Tartu_Art_House	rdfs:comment	&amp;quot;Museum in Estland&amp;quot;@de	.&lt;br /&gt;
&lt;br /&gt;
You may safely remove all the comments and most (or all) names, except these which you really use in your questions and rules, if any. For example, you may want to keep just one &amp;lt;i&amp;gt;rdfs:label&amp;lt;/i&amp;gt; for an object, without indicating a language (the @-stuff) at all.&lt;br /&gt;
&lt;br /&gt;
= LLM generated data =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ideas for adding additional facts sightseeing objects, what is close to what etc for tourism and facts about actors or musicians etc for entertainment/culture.&lt;br /&gt;
&lt;br /&gt;
You can use any LLM chat or API. For API usage we suggest using [https://together.ai together.ai], that allows you to use open source LLMs for a small fee. As a new user you will get 25$ credit, which will last for a long time using cheaper models (see [https://www.together.ai/pricing https://www.together.ai/pricing]). Two of their models are available for free: Llama-3.3-70B-Instruct-Turbo-Free and DeepSeek-R1-Distill-Llama-70B-free.&lt;br /&gt;
&lt;br /&gt;
= Rules and questions =&lt;br /&gt;
&lt;br /&gt;
The best way to try out rules and questions is to use http://logictools.org for quick experiments along with small selections of data. For example, try&lt;br /&gt;
&lt;br /&gt;
  triple(&amp;quot;yago:Lake_Peipsi&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(X,Y,&amp;quot;yago:Lake&amp;quot;) =&amp;gt; $ans(X).&lt;br /&gt;
&lt;br /&gt;
and you should get a single answer along with the trivial proof. To get more answers, click the &amp;quot;Advanced&amp;quot; button and copy { &amp;quot;max_answers&amp;quot;: 2} into the strategy box. Beware that in case you ask for more answers than there really are, the reasoner may just keeping looking for more, eventually timeouting, and not giving any answers at all.&lt;br /&gt;
&lt;br /&gt;
Now let us try out something simple, but not totally trivial:&lt;br /&gt;
&lt;br /&gt;
  triple(yago:Jaan_Lepp,	schema:birthPlace,      yago:Anija_Parish).&lt;br /&gt;
  triple(yago:August_Vaga,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  triple(yago:Silvi_Vrait,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  triple(yago:Karmen_Pedaru,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,schema:birthPlace,Z) =&amp;gt; bornin(X,K).&lt;br /&gt;
  &lt;br /&gt;
  bornin(X,Z) &amp;amp; bornin(Y,Z) =&amp;gt; borninsameplace(X,Y).&lt;br /&gt;
  &lt;br /&gt;
  borninsameplace(X,Y) &amp;amp; -$substr(X,Y) &amp;amp; -$substr(Y,X)  =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
Put, say &amp;lt;i&amp;gt;{ &amp;quot;max_answers&amp;quot;: 3}&amp;lt;/i&amp;gt; to the strategy box, to get more answers than one.&lt;br /&gt;
&lt;br /&gt;
Here we took a small selection of data from one of the files and added a few rules. Notice the trick with the special builtin predicate &amp;lt;i&amp;gt;$substr(K,Z)&amp;lt;/i&amp;gt;: it treats the argument constants as strings and checks whether the first one is a substring of the second one. Thus the &amp;lt;i&amp;gt;-$substr(X,Y) &amp;amp; -$substr(Y,X)&amp;lt;/i&amp;gt; simply eliminates equal constants  to avoid answers like &amp;lt;i&amp;gt;$ans(&#039;yago:August_Vaga&#039;,&#039;yago:August_Vaga&#039;).&amp;lt;/i&amp;gt;. Alternatively, if we had used the quotation marks around person id-s, we could have used the rule&lt;br /&gt;
&lt;br /&gt;
  borninsameplace(X,Y) &amp;amp; X!=Y =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
instead.&lt;br /&gt;
&lt;br /&gt;
Next, a slightly more interesting example (use &amp;lt;i&amp;gt;{ &amp;quot;max_answers&amp;quot;: 6}&amp;lt;/i&amp;gt; or less):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  triple(&amp;quot;yago:Lake_Peipus&amp;quot;,&amp;quot;rdf:type&amp;quot;,	&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Veisjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  &lt;br /&gt;
  triple(&amp;quot;yago:Väike_Emajõgi&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Tänassilma_River&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Tarvastu_River&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Emajõgi&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Veisjärv&amp;quot;,&amp;quot;yago:flowsInto&amp;quot;,&amp;quot;yago:Õhne&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Õhne&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Emajõgi&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Lake_Peipus&amp;quot;).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,&amp;quot;yago:flowsInto&amp;quot;,Y) =&amp;gt; boattravel(X,Y).&lt;br /&gt;
  triple(X,&amp;quot;yago:flowsInto&amp;quot;,Y) =&amp;gt; boattravel(Y,X).&lt;br /&gt;
  &lt;br /&gt;
  boattravel(X,Y) &amp;amp; boattravel(Y,Z) =&amp;gt; boattravel(X,Z).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;) &amp;amp; triple(Z,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;) &amp;amp; boattravel(X,Y) &amp;amp; boattravel(Y,Z) &amp;amp; X!=Z =&amp;gt; laketolake(X,Z).&lt;br /&gt;
  laketolake(X,Y) =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
Interestingly, the Yago dataset uses two different id-s for Peipsi: &amp;lt;i&amp;gt;yago:Lake_Peipus&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;yago:Lake_Peipsi&amp;lt;/i&amp;gt; with several additional triplets indicating equality of these id-s to some other id-s, but not to each other! The related datasets for these id-s are also different. Conceptually, this is an errorish thingy in Yago.&lt;br /&gt;
&lt;br /&gt;
  yago:Lake_Peipsi	rdf:type	yago:Lake&lt;br /&gt;
  yago:Lake_Peipsi	owl:sameAs	wd:Q2627792&lt;br /&gt;
  yago:Lake_Peipsi	schema:sameAs	&amp;quot;/g/1217z1dh&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  yago:Lake_Peipus	rdf:type	yago:Lake&lt;br /&gt;
  yago:Lake_Peipus	owl:sameAs	wd:Q19253&lt;br /&gt;
  yago:Lake_Peipus	schema:sameAs	&amp;quot;/m/021yh2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Ideas for writing your own rules =&lt;br /&gt;
&lt;br /&gt;
The main recommendation is thinking what nontrivial things we could ask from the dataset and then looking whether it actually contains sufficient data for this. If you have an idea, try it out with small examples first.&lt;br /&gt;
&lt;br /&gt;
Try to combine different rules requiring the generation of longer nontrivial proofs for answers.&lt;br /&gt;
&lt;br /&gt;
Some ideas, including somewhat crazy ones:&lt;br /&gt;
&lt;br /&gt;
* Categorizing objects into larger categories, using the transivity of rdf:type (you have to write your own rule for the transitivity). &lt;br /&gt;
* What city/town/lake/island is inside what, according to located-in-estonia.txt. What can you derive from this, say, using transitivity of &amp;lt;i&amp;gt;inside&amp;lt;/i&amp;gt;?&lt;br /&gt;
* Who was born where and how could they potentially travel with the boat to a place another person was born :)&lt;br /&gt;
* Finding data from people-in-estonia.txt for persons active in created-in-estonia.txt. Finding people born nearby active in the same movies. Etc.&lt;br /&gt;
* Convert birth dates like &amp;lt;i&amp;gt;yago:Endel_Ruberg       schema:birthDate        &amp;quot;1917-05-21T00:00:00Z&amp;quot;^^xsd:dateTime&amp;lt;/i&amp;gt; to simple integers and use the built-in arithmetic of th e reasoner (see &amp;quot;About&amp;quot; -&amp;gt; &amp;quot;Special symbols and additional constructions&amp;quot; in logictools) to filter out suitable people. Who is surely not alive any more? Who are roughly of the same age and have something more in common?&lt;br /&gt;
* Converting triplets in the dataset &amp;lt;i&amp;gt;triple(a,b,c)&amp;lt;/i&amp;gt; where the first and second argument should conceptually strictly determine the third (like when c is a birthdate) to equalities like &amp;lt;i&amp;gt;b(a)=c&amp;lt;/i&amp;gt; instead and then using terms and equalities in your rules for such cases.&lt;br /&gt;
* Generating trips with actual paths shown in answers: you will need function term arguments in your predicates for this, see the example from the first lecture:&lt;br /&gt;
&lt;br /&gt;
  railroad(tallinn,tapa).&lt;br /&gt;
  railroad(tapa,tartu).&lt;br /&gt;
  highway(tallinn,virtsu).&lt;br /&gt;
  sealane(virtsu,kuivastu).&lt;br /&gt;
  highway(kuressaare,kuivastu).&lt;br /&gt;
  railroad(X,Y) =&amp;gt; railroad(Y,X).&lt;br /&gt;
  highway(X,Y) =&amp;gt; highway(Y,X).&lt;br /&gt;
  sealane(X,Y) =&amp;gt; sealane(Y,X).&lt;br /&gt;
  railroad(X,Y) =&amp;gt; easytravel(X,Y,use(train,X,Y)).&lt;br /&gt;
  highway(X,Y) =&amp;gt; easytravel(X,Y,use(bus,X,Y)).&lt;br /&gt;
  sealane(X,Y) =&amp;gt; easytravel(X,Y,use(ship,X,Y)).&lt;br /&gt;
  easytravel(X,Y,P1) &amp;amp; easytravel(Y,Z,P2) =&amp;gt; easytravel(X,Z,combine(P1,P2)).&lt;br /&gt;
  easytravel(tartu,X,Y) &amp;amp; spacity(X) =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
= Using large datasets: logictools vs command line reasoner gkc =&lt;br /&gt;
&lt;br /&gt;
Logictools is unable to eat very large datasets and the options to control it are limited. Also, experimenting only on the web may be cumbersome. &lt;br /&gt;
&lt;br /&gt;
Thus I&#039;d recommend to download the full-powered version of the reasoner used in logictools  from https://github.com/tammet/gkc : it is best to use the somewhat older release https://github.com/tammet/gkc/releases/tag/v0.6.0 which has the same codebase as logictools. Just take the provided windows, linux or macos binary: no need to compile yourself.&lt;br /&gt;
&lt;br /&gt;
A rather thorough tutorial of gkc with examples is README.md here: https://github.com/tammet/gkc/blob/master/Examples/README.md&lt;br /&gt;
&lt;br /&gt;
= Optional: additional datasets =&lt;br /&gt;
&lt;br /&gt;
In case you are adventurous, try to use additional datasets and combine these with the ones provided by Riina! For example, the Yago stuff contains triplets like&lt;br /&gt;
&lt;br /&gt;
  yago:Lake_Peipsi	owl:sameAs	wd:Q2627792 &lt;br /&gt;
&lt;br /&gt;
with the &amp;quot;wd:&amp;quot; defined above as &amp;quot;http://www.wikidata.org/entity/&amp;quot;, thus leading to pages like  http://www.wikidata.org/entity/Q2627792 . Now, looking at the source of this page, you find rows like &amp;lt;code&amp;gt;&amp;lt;link rel=&amp;quot;alternate&amp;quot; href=&amp;quot;https://www.wikidata.org/wiki/Special:EntityData/Q2627792.nt&amp;quot; type=&amp;quot;application/n-triples&amp;quot;&amp;gt;&amp;lt;/code&amp;gt; with the link &lt;br /&gt;
https://www.wikidata.org/wiki/Special:EntityData/Q2627792.nt leading to a large set of triplets related to Lake Peipsi! Most of these represent some specific complex encodings of this wikidata web page itself, but several are actually about Peipsi.&lt;br /&gt;
&lt;br /&gt;
A list of well-known and used large &amp;quot;generic&amp;quot; fact and knowledge bases can be found in http://lambda.ee/wiki/Teadmiste_formaliseerimine#Block_3:_General-knowledge_databases . You may want to have a look at these, but beware: obviously it takes time to understand and process. Another cool source is [https://www.kaggle.com/datasets kaggle.]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=KR_2025_homework_part_1&amp;diff=21969</id>
		<title>KR 2025 homework part 1</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=KR_2025_homework_part_1&amp;diff=21969"/>
		<updated>2025-02-12T12:36:57Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You will have to write a small program to convert/filter data to a suitable format for experimenting with a logical reasoner, and then write ca 10 nontrivial rules for answering questions. Add some facts using LLM.&lt;br /&gt;
&lt;br /&gt;
Finally, experiment with the reasoner on this data + rules and make a small presentation of your data, rules, successes and failures. &lt;br /&gt;
&lt;br /&gt;
The presentation does not have to be made with special slides and a long writeup (although this is also OK). You are expected to show the data, rules and results and briefly explain your ideas, experiments and the work process. Just using an editor for showing this stuff is OK. Best if you can also make a small demo with the reasoner actually running and proving some of the queries.&lt;br /&gt;
&lt;br /&gt;
Not everything you try out needs to work: some failures are also interesting.&lt;br /&gt;
&lt;br /&gt;
We award a few extra points for adventurous people adding extra data into the fray; see the last section about optional stuff.&lt;br /&gt;
&lt;br /&gt;
= Data =&lt;br /&gt;
&lt;br /&gt;
Riina took the large datasets from https://yago-knowledge.org/ and prepared relatively small selections (all about something Estonian) from this data. The link to the files is [https://cs.taltech.ee/staff/riina.maigre/iti8700/lab1/ here]. The data is presented as plain triplets, no fancy encoding (except namespaces) is involved.&lt;br /&gt;
&lt;br /&gt;
This set of files also contains an estonian_taxonomy.txt file, which is a subset of yago-taxonomy.txt. Using all or part of estonian_taxonomy.txt file might help to write more complex rules.&lt;br /&gt;
&lt;br /&gt;
Suggested topics are tourism and entertainment/culture.&lt;br /&gt;
&lt;br /&gt;
First, please download the files and explore them a bit. Then convert the files to the format our reasoner gk (or its web version http://logictools.org) can eat. Write a program for this! Trying to just replace/filter stuff using an editor will become very cumbersome soon.&lt;br /&gt;
&lt;br /&gt;
For example, the triplet&lt;br /&gt;
    yago:Lake_Peipsi	rdf:type	yago:Lake&lt;br /&gt;
can be converted to&lt;br /&gt;
    triple(yago:Lake_Peipsi,rdf:type,yago:Lake).&lt;br /&gt;
or with the quotation marks&lt;br /&gt;
    triple(&amp;quot;yago:Lake_Peipsi&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Notice that I have not bothered to replace the abbreviations of namespaces like &amp;lt;i&amp;gt;yago&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;rdf&amp;lt;/i&amp;gt; etc with full names &amp;lt;i&amp;gt;http://yago-knowledge.org/resource/&amp;lt;/i&amp;gt; and &lt;br /&gt;
&amp;lt;i&amp;gt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;lt;/i&amp;gt;: the abbreviations make the symbols unique enough for our purposes.&lt;br /&gt;
&lt;br /&gt;
The predicate &amp;lt;i&amp;gt;triple&amp;lt;/i&amp;gt; is really arbitrary: you may use any name you like. You may also use the fourth argument for type, if you wish (like &amp;quot;string&amp;quot;/&amp;quot;integer&amp;quot;/&amp;quot;id&amp;quot;, in case it helps). Importantly, there are subtle differences between writing constants like &amp;lt;i&amp;gt;yago:Lake_Peipsi&amp;lt;/i&amp;gt; with or without quotation marks:&lt;br /&gt;
* Without quotation the reasoner does not assume that two different constants necessarily mean different objects. Saying &amp;lt;i&amp;gt;yago:Lake_Peipsi = yago:Lake_Peipus&amp;lt;/i&amp;gt; does not lead to a contradiction. Also, non-ascii symbols are generally not ok for non-quoted constants.&lt;br /&gt;
* Quotation marks make the reasoner to treat constants as strings, and thus &amp;lt;i&amp;gt;&amp;quot;yago:Lake_Peipsi&amp;quot; = &amp;quot;yago:Lake_Peipus&amp;quot;&amp;lt;/i&amp;gt; is a contradiction. Also, non-ascii symbols are OK.&lt;br /&gt;
&lt;br /&gt;
Observe that the datasets contain a huge amount of labels (i.e. human names) and comments in different languages, like&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@sh      .&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@lfn     .&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@es      .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Tartu&amp;quot;@ko      .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Tartu&amp;quot;@mhr     .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Jurjev&amp;quot;@cs     .&lt;br /&gt;
  yago:Tartu_Art_House	rdfs:comment	&amp;quot;museum di Estonia&amp;quot;@id	.&lt;br /&gt;
  yago:Tartu_Art_House	rdfs:comment	&amp;quot;Museum in Estland&amp;quot;@de	.&lt;br /&gt;
&lt;br /&gt;
You may safely remove all the comments and most (or all) names, except these which you really use in your questions and rules, if any. For example, you may want to keep just one &amp;lt;i&amp;gt;rdfs:label&amp;lt;/i&amp;gt; for an object, without indicating a language (the @-stuff) at all.&lt;br /&gt;
&lt;br /&gt;
= LLM generated data =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ideas for adding additional facts sightseeing objects, what is close to what etc for tourism and facts about actors or musicians etc for entertainment/culture.&lt;br /&gt;
&lt;br /&gt;
You can use any LLM chat or API. For API usage we suggest using [https://together.ai together.ai], that allows you to use open source LLMs for a small fee. As a new user you will get 25$ credit, which will last for a long time using cheaper models (see [https://www.together.ai/pricing https://www.together.ai/pricing]). Two of their models are available for free: Llama-3.3-70B-Instruct-Turbo-Free and DeepSeek-R1-Distill-Llama-70B-free.&lt;br /&gt;
&lt;br /&gt;
= Rules and questions =&lt;br /&gt;
&lt;br /&gt;
The best way to try out rules and questions is to use http://logictools.org for quick experiments along with small selections of data. For example, try&lt;br /&gt;
&lt;br /&gt;
  triple(&amp;quot;yago:Lake_Peipsi&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(X,Y,&amp;quot;yago:Lake&amp;quot;) =&amp;gt; $ans(X).&lt;br /&gt;
&lt;br /&gt;
and you should get a single answer along with the trivial proof. To get more answers, click the &amp;quot;Advanced&amp;quot; button and copy { &amp;quot;max_answers&amp;quot;: 2} into the strategy box. Beware that in case you ask for more answers than there really are, the reasoner may just keeping looking for more, eventually timeouting, and not giving any answers at all.&lt;br /&gt;
&lt;br /&gt;
Now let us try out something simple, but not totally trivial:&lt;br /&gt;
&lt;br /&gt;
  triple(yago:Jaan_Lepp,	schema:birthPlace,      yago:Anija_Parish).&lt;br /&gt;
  triple(yago:August_Vaga,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  triple(yago:Silvi_Vrait,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  triple(yago:Karmen_Pedaru,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,schema:birthPlace,Z) =&amp;gt; bornin(X,K).&lt;br /&gt;
  &lt;br /&gt;
  bornin(X,Z) &amp;amp; bornin(Y,Z) =&amp;gt; borninsameplace(X,Y).&lt;br /&gt;
  &lt;br /&gt;
  borninsameplace(X,Y) &amp;amp; -$substr(X,Y) &amp;amp; -$substr(Y,X)  =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
Put, say &amp;lt;i&amp;gt;{ &amp;quot;max_answers&amp;quot;: 3}&amp;lt;/i&amp;gt; to the strategy box, to get more answers than one.&lt;br /&gt;
&lt;br /&gt;
Here we took a small selection of data from one of the files and added a few rules. Notice the trick with the special builtin predicate &amp;lt;i&amp;gt;$substr(K,Z)&amp;lt;/i&amp;gt;: it treats the argument constants as strings and checks whether the first one is a substring of the second one. Thus the &amp;lt;i&amp;gt;-$substr(X,Y) &amp;amp; -$substr(Y,X)&amp;lt;/i&amp;gt; simply eliminates equal constants  to avoid answers like &amp;lt;i&amp;gt;$ans(&#039;yago:August_Vaga&#039;,&#039;yago:August_Vaga&#039;).&amp;lt;/i&amp;gt;. Alternatively, if we had used the quotation marks around person id-s, we could have used the rule&lt;br /&gt;
&lt;br /&gt;
  borninsameplace(X,Y) &amp;amp; X!=Y =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
instead.&lt;br /&gt;
&lt;br /&gt;
Next, a slightly more interesting example (use &amp;lt;i&amp;gt;{ &amp;quot;max_answers&amp;quot;: 6}&amp;lt;/i&amp;gt; or less):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  triple(&amp;quot;yago:Lake_Peipus&amp;quot;,&amp;quot;rdf:type&amp;quot;,	&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Veisjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  &lt;br /&gt;
  triple(&amp;quot;yago:Väike_Emajõgi&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Tänassilma_River&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Tarvastu_River&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Emajõgi&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Veisjärv&amp;quot;,&amp;quot;yago:flowsInto&amp;quot;,&amp;quot;yago:Õhne&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Õhne&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Emajõgi&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Lake_Peipus&amp;quot;).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,&amp;quot;yago:flowsInto&amp;quot;,Y) =&amp;gt; boattravel(X,Y).&lt;br /&gt;
  triple(X,&amp;quot;yago:flowsInto&amp;quot;,Y) =&amp;gt; boattravel(Y,X).&lt;br /&gt;
  &lt;br /&gt;
  boattravel(X,Y) &amp;amp; boattravel(Y,Z) =&amp;gt; boattravel(X,Z).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;) &amp;amp; triple(Z,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;) &amp;amp; boattravel(X,Y) &amp;amp; boattravel(Y,Z) &amp;amp; X!=Z =&amp;gt; laketolake(X,Z).&lt;br /&gt;
  laketolake(X,Y) =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
Interestingly, the Yago dataset uses two different id-s for Peipsi: &amp;lt;i&amp;gt;yago:Lake_Peipus&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;yago:Lake_Peipsi&amp;lt;/i&amp;gt; with several additional triplets indicating equality of these id-s to some other id-s, but not to each other! The related datasets for these id-s are also different. Conceptually, this is an errorish thingy in Yago.&lt;br /&gt;
&lt;br /&gt;
  yago:Lake_Peipsi	rdf:type	yago:Lake&lt;br /&gt;
  yago:Lake_Peipsi	owl:sameAs	wd:Q2627792&lt;br /&gt;
  yago:Lake_Peipsi	schema:sameAs	&amp;quot;/g/1217z1dh&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  yago:Lake_Peipus	rdf:type	yago:Lake&lt;br /&gt;
  yago:Lake_Peipus	owl:sameAs	wd:Q19253&lt;br /&gt;
  yago:Lake_Peipus	schema:sameAs	&amp;quot;/m/021yh2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Ideas for writing your own rules =&lt;br /&gt;
&lt;br /&gt;
The main recommendation is thinking what nontrivial things we could ask from the dataset and then looking whether it actually contains sufficient data for this. If you have an idea, try it out with small examples first.&lt;br /&gt;
&lt;br /&gt;
Try to combine different rules requiring the generation of longer nontrivial proofs for answers.&lt;br /&gt;
&lt;br /&gt;
Some ideas, including somewhat crazy ones:&lt;br /&gt;
&lt;br /&gt;
* Categorizing objects into larger categories, using the transivity of rdf:type (you have to write your own rule for the transitivity). &lt;br /&gt;
* What city/town/lake/island is inside what, according to located-in-estonia.txt. What can you derive from this, say, using transitivity of &amp;lt;i&amp;gt;inside&amp;lt;/i&amp;gt;?&lt;br /&gt;
* Who was born where and how could they potentially travel with the boat to a place another person was born :)&lt;br /&gt;
* Finding data from people-in-estonia.txt for persons active in created-in-estonia.txt. Finding people born nearby active in the same movies. Etc.&lt;br /&gt;
* Convert birth dates like &amp;lt;i&amp;gt;yago:Endel_Ruberg       schema:birthDate        &amp;quot;1917-05-21T00:00:00Z&amp;quot;^^xsd:dateTime&amp;lt;/i&amp;gt; to simple integers and use the built-in arithmetic of th e reasoner (see &amp;quot;About&amp;quot; -&amp;gt; &amp;quot;Special symbols and additional constructions&amp;quot; in logictools) to filter out suitable people. Who is surely not alive any more? Who are roughly of the same age and have something more in common?&lt;br /&gt;
* Converting triplets in the dataset &amp;lt;i&amp;gt;triple(a,b,c)&amp;lt;/i&amp;gt; where the first and second argument should conceptually strictly determine the third (like when c is a birthdate) to equalities like &amp;lt;i&amp;gt;b(a)=c&amp;lt;/i&amp;gt; instead and then using terms and equalities in your rules for such cases.&lt;br /&gt;
* Generating trips with actual paths shown in answers: you will need function term arguments in your predicates for this, see the example from the first lecture:&lt;br /&gt;
&lt;br /&gt;
  railroad(tallinn,tapa).&lt;br /&gt;
  railroad(tapa,tartu).&lt;br /&gt;
  highway(tallinn,virtsu).&lt;br /&gt;
  sealane(virtsu,kuivastu).&lt;br /&gt;
  highway(kuressaare,kuivastu).&lt;br /&gt;
  railroad(X,Y) =&amp;gt; railroad(Y,X).&lt;br /&gt;
  highway(X,Y) =&amp;gt; highway(Y,X).&lt;br /&gt;
  sealane(X,Y) =&amp;gt; sealane(Y,X).&lt;br /&gt;
  railroad(X,Y) =&amp;gt; easytravel(X,Y,use(train,X,Y)).&lt;br /&gt;
  highway(X,Y) =&amp;gt; easytravel(X,Y,use(bus,X,Y)).&lt;br /&gt;
  sealane(X,Y) =&amp;gt; easytravel(X,Y,use(ship,X,Y)).&lt;br /&gt;
  easytravel(X,Y,P1) &amp;amp; easytravel(Y,Z,P2) =&amp;gt; easytravel(X,Z,combine(P1,P2)).&lt;br /&gt;
  easytravel(tartu,X,Y) &amp;amp; spacity(X) =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
= Using large datasets: logictools vs command line reasoner gkc =&lt;br /&gt;
&lt;br /&gt;
Logictools is unable to eat very large datasets and the options to control it are limited. Also, experimenting only on the web may be cumbersome. &lt;br /&gt;
&lt;br /&gt;
Thus I&#039;d recommend to download the full-powered version of the reasoner used in logictools  from https://github.com/tammet/gkc : it is best to use the somewhat older release https://github.com/tammet/gkc/releases/tag/v0.6.0 which has the same codebase as logictools. Just take the provided windows, linux or macos binary: no need to compile yourself.&lt;br /&gt;
&lt;br /&gt;
A rather thorough tutorial of gkc with examples is README.md here: https://github.com/tammet/gkc/blob/master/Examples/README.md&lt;br /&gt;
&lt;br /&gt;
= Optional: additional datasets =&lt;br /&gt;
&lt;br /&gt;
In case you are adventurous, try to use additional datasets and combine these with the ones provided by Riina! For example, the Yago stuff contains triplets like&lt;br /&gt;
&lt;br /&gt;
  yago:Lake_Peipsi	owl:sameAs	wd:Q2627792 &lt;br /&gt;
&lt;br /&gt;
with the &amp;quot;wd:&amp;quot; defined above as &amp;quot;http://www.wikidata.org/entity/&amp;quot;, thus leading to pages like  http://www.wikidata.org/entity/Q2627792 . Now, looking at the source of this page, you find rows like &amp;lt;code&amp;gt;&amp;lt;link rel=&amp;quot;alternate&amp;quot; href=&amp;quot;https://www.wikidata.org/wiki/Special:EntityData/Q2627792.nt&amp;quot; type=&amp;quot;application/n-triples&amp;quot;&amp;gt;&amp;lt;/code&amp;gt; with the link &lt;br /&gt;
https://www.wikidata.org/wiki/Special:EntityData/Q2627792.nt leading to a large set of triplets related to Lake Peipsi! Most of these represent some specific complex encodings of this wikidata web page itself, but several are actually about Peipsi.&lt;br /&gt;
&lt;br /&gt;
A list of well-known and used large &amp;quot;generic&amp;quot; fact and knowledge bases can be found in http://lambda.ee/wiki/Teadmiste_formaliseerimine#Block_3:_General-knowledge_databases . You may want to have a look at these, but beware: obviously it takes time to understand and process. Another cool source is [https://www.kaggle.com/datasets kaggle.]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=KR_2025_homework_part_1&amp;diff=21968</id>
		<title>KR 2025 homework part 1</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=KR_2025_homework_part_1&amp;diff=21968"/>
		<updated>2025-02-12T12:30:59Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* Ideas for writing your own rules */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You will have to write a small program to convert/filter data to a suitable format for experimenting with a logical reasoner, and then write ca 10 nontrivial rules for answering questions. Add some facts using LLM.&lt;br /&gt;
&lt;br /&gt;
Finally, experiment with the reasoner on this data + rules and make a small presentation of your data, rules, successes and failures. &lt;br /&gt;
&lt;br /&gt;
The presentation does not have to be made with special slides and a long writeup (although this is also OK). You are expected to show the data, rules and results and briefly explain your ideas, experiments and the work process. Just using an editor for showing this stuff is OK. Best if you can also make a small demo with the reasoner actually running and proving some of the queries.&lt;br /&gt;
&lt;br /&gt;
Not everything you try out needs to work: some failures are also interesting.&lt;br /&gt;
&lt;br /&gt;
We award a few extra points for adventurous people adding extra data into the fray; see the last section about optional stuff.&lt;br /&gt;
&lt;br /&gt;
= Data =&lt;br /&gt;
&lt;br /&gt;
Riina took the large datasets from https://yago-knowledge.org/ and prepared relatively small selections (all about something Estonian) from this data. The link to the files is [https://cs.taltech.ee/staff/riina.maigre/iti8700/lab1/ here]. The data is presented as plain triplets, no fancy encoding (except namespaces) is involved.&lt;br /&gt;
&lt;br /&gt;
Suggested topics are tourism and entertainment/culture.&lt;br /&gt;
&lt;br /&gt;
First, please download the files and explore them a bit. Then convert the files to the format our reasoner gk (or its web version http://logictools.org) can eat. Write a program for this! Trying to just replace/filter stuff using an editor will become very cumbersome soon.&lt;br /&gt;
&lt;br /&gt;
For example, the triplet&lt;br /&gt;
    yago:Lake_Peipsi	rdf:type	yago:Lake&lt;br /&gt;
can be converted to&lt;br /&gt;
    triple(yago:Lake_Peipsi,rdf:type,yago:Lake).&lt;br /&gt;
or with the quotation marks&lt;br /&gt;
    triple(&amp;quot;yago:Lake_Peipsi&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Notice that I have not bothered to replace the abbreviations of namespaces like &amp;lt;i&amp;gt;yago&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;rdf&amp;lt;/i&amp;gt; etc with full names &amp;lt;i&amp;gt;http://yago-knowledge.org/resource/&amp;lt;/i&amp;gt; and &lt;br /&gt;
&amp;lt;i&amp;gt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;lt;/i&amp;gt;: the abbreviations make the symbols unique enough for our purposes.&lt;br /&gt;
&lt;br /&gt;
The predicate &amp;lt;i&amp;gt;triple&amp;lt;/i&amp;gt; is really arbitrary: you may use any name you like. You may also use the fourth argument for type, if you wish (like &amp;quot;string&amp;quot;/&amp;quot;integer&amp;quot;/&amp;quot;id&amp;quot;, in case it helps). Importantly, there are subtle differences between writing constants like &amp;lt;i&amp;gt;yago:Lake_Peipsi&amp;lt;/i&amp;gt; with or without quotation marks:&lt;br /&gt;
* Without quotation the reasoner does not assume that two different constants necessarily mean different objects. Saying &amp;lt;i&amp;gt;yago:Lake_Peipsi = yago:Lake_Peipus&amp;lt;/i&amp;gt; does not lead to a contradiction. Also, non-ascii symbols are generally not ok for non-quoted constants.&lt;br /&gt;
* Quotation marks make the reasoner to treat constants as strings, and thus &amp;lt;i&amp;gt;&amp;quot;yago:Lake_Peipsi&amp;quot; = &amp;quot;yago:Lake_Peipus&amp;quot;&amp;lt;/i&amp;gt; is a contradiction. Also, non-ascii symbols are OK.&lt;br /&gt;
&lt;br /&gt;
Observe that the datasets contain a huge amount of labels (i.e. human names) and comments in different languages, like&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@sh      .&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@lfn     .&lt;br /&gt;
  yago:Tartu      rdfs:label      &amp;quot;Tartu&amp;quot;@es      .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Tartu&amp;quot;@ko      .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Tartu&amp;quot;@mhr     .&lt;br /&gt;
  yago:Tartu      schema:alternateName    &amp;quot;Jurjev&amp;quot;@cs     .&lt;br /&gt;
  yago:Tartu_Art_House	rdfs:comment	&amp;quot;museum di Estonia&amp;quot;@id	.&lt;br /&gt;
  yago:Tartu_Art_House	rdfs:comment	&amp;quot;Museum in Estland&amp;quot;@de	.&lt;br /&gt;
&lt;br /&gt;
You may safely remove all the comments and most (or all) names, except these which you really use in your questions and rules, if any. For example, you may want to keep just one &amp;lt;i&amp;gt;rdfs:label&amp;lt;/i&amp;gt; for an object, without indicating a language (the @-stuff) at all.&lt;br /&gt;
&lt;br /&gt;
= LLM generated data =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ideas for adding additional facts sightseeing objects, what is close to what etc for tourism and facts about actors or musicians etc for entertainment/culture.&lt;br /&gt;
&lt;br /&gt;
You can use any LLM chat or API. For API usage we suggest using [https://together.ai together.ai], that allows you to use open source LLMs for a small fee. As a new user you will get 25$ credit, which will last for a long time using cheaper models (see [https://www.together.ai/pricing https://www.together.ai/pricing]). Two of their models are available for free: Llama-3.3-70B-Instruct-Turbo-Free and DeepSeek-R1-Distill-Llama-70B-free.&lt;br /&gt;
&lt;br /&gt;
= Rules and questions =&lt;br /&gt;
&lt;br /&gt;
The best way to try out rules and questions is to use http://logictools.org for quick experiments along with small selections of data. For example, try&lt;br /&gt;
&lt;br /&gt;
  triple(&amp;quot;yago:Lake_Peipsi&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(X,Y,&amp;quot;yago:Lake&amp;quot;) =&amp;gt; $ans(X).&lt;br /&gt;
&lt;br /&gt;
and you should get a single answer along with the trivial proof. To get more answers, click the &amp;quot;Advanced&amp;quot; button and copy { &amp;quot;max_answers&amp;quot;: 2} into the strategy box. Beware that in case you ask for more answers than there really are, the reasoner may just keeping looking for more, eventually timeouting, and not giving any answers at all.&lt;br /&gt;
&lt;br /&gt;
Now let us try out something simple, but not totally trivial:&lt;br /&gt;
&lt;br /&gt;
  triple(yago:Jaan_Lepp,	schema:birthPlace,      yago:Anija_Parish).&lt;br /&gt;
  triple(yago:August_Vaga,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  triple(yago:Silvi_Vrait,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  triple(yago:Karmen_Pedaru,	schema:birthPlace,	yago:Kehra).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,schema:birthPlace,Z) =&amp;gt; bornin(X,K).&lt;br /&gt;
  &lt;br /&gt;
  bornin(X,Z) &amp;amp; bornin(Y,Z) =&amp;gt; borninsameplace(X,Y).&lt;br /&gt;
  &lt;br /&gt;
  borninsameplace(X,Y) &amp;amp; -$substr(X,Y) &amp;amp; -$substr(Y,X)  =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
Put, say &amp;lt;i&amp;gt;{ &amp;quot;max_answers&amp;quot;: 3}&amp;lt;/i&amp;gt; to the strategy box, to get more answers than one.&lt;br /&gt;
&lt;br /&gt;
Here we took a small selection of data from one of the files and added a few rules. Notice the trick with the special builtin predicate &amp;lt;i&amp;gt;$substr(K,Z)&amp;lt;/i&amp;gt;: it treats the argument constants as strings and checks whether the first one is a substring of the second one. Thus the &amp;lt;i&amp;gt;-$substr(X,Y) &amp;amp; -$substr(Y,X)&amp;lt;/i&amp;gt; simply eliminates equal constants  to avoid answers like &amp;lt;i&amp;gt;$ans(&#039;yago:August_Vaga&#039;,&#039;yago:August_Vaga&#039;).&amp;lt;/i&amp;gt;. Alternatively, if we had used the quotation marks around person id-s, we could have used the rule&lt;br /&gt;
&lt;br /&gt;
  borninsameplace(X,Y) &amp;amp; X!=Y =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
instead.&lt;br /&gt;
&lt;br /&gt;
Next, a slightly more interesting example (use &amp;lt;i&amp;gt;{ &amp;quot;max_answers&amp;quot;: 6}&amp;lt;/i&amp;gt; or less):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  triple(&amp;quot;yago:Lake_Peipus&amp;quot;,&amp;quot;rdf:type&amp;quot;,	&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Veisjärv&amp;quot;,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;).&lt;br /&gt;
  &lt;br /&gt;
  triple(&amp;quot;yago:Väike_Emajõgi&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Tänassilma_River&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Tarvastu_River&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Võrtsjärv&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Emajõgi&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Veisjärv&amp;quot;,&amp;quot;yago:flowsInto&amp;quot;,&amp;quot;yago:Õhne&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Õhne&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Võrtsjärv&amp;quot;).&lt;br /&gt;
  triple(&amp;quot;yago:Emajõgi&amp;quot;, &amp;quot;yago:flowsInto&amp;quot;, &amp;quot;yago:Lake_Peipus&amp;quot;).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,&amp;quot;yago:flowsInto&amp;quot;,Y) =&amp;gt; boattravel(X,Y).&lt;br /&gt;
  triple(X,&amp;quot;yago:flowsInto&amp;quot;,Y) =&amp;gt; boattravel(Y,X).&lt;br /&gt;
  &lt;br /&gt;
  boattravel(X,Y) &amp;amp; boattravel(Y,Z) =&amp;gt; boattravel(X,Z).&lt;br /&gt;
  &lt;br /&gt;
  triple(X,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;) &amp;amp; triple(Z,&amp;quot;rdf:type&amp;quot;,&amp;quot;yago:Lake&amp;quot;) &amp;amp; boattravel(X,Y) &amp;amp; boattravel(Y,Z) &amp;amp; X!=Z =&amp;gt; laketolake(X,Z).&lt;br /&gt;
  laketolake(X,Y) =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
Interestingly, the Yago dataset uses two different id-s for Peipsi: &amp;lt;i&amp;gt;yago:Lake_Peipus&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;yago:Lake_Peipsi&amp;lt;/i&amp;gt; with several additional triplets indicating equality of these id-s to some other id-s, but not to each other! The related datasets for these id-s are also different. Conceptually, this is an errorish thingy in Yago.&lt;br /&gt;
&lt;br /&gt;
  yago:Lake_Peipsi	rdf:type	yago:Lake&lt;br /&gt;
  yago:Lake_Peipsi	owl:sameAs	wd:Q2627792&lt;br /&gt;
  yago:Lake_Peipsi	schema:sameAs	&amp;quot;/g/1217z1dh&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  yago:Lake_Peipus	rdf:type	yago:Lake&lt;br /&gt;
  yago:Lake_Peipus	owl:sameAs	wd:Q19253&lt;br /&gt;
  yago:Lake_Peipus	schema:sameAs	&amp;quot;/m/021yh2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Ideas for writing your own rules =&lt;br /&gt;
&lt;br /&gt;
The main recommendation is thinking what nontrivial things we could ask from the dataset and then looking whether it actually contains sufficient data for this. If you have an idea, try it out with small examples first.&lt;br /&gt;
&lt;br /&gt;
Try to combine different rules requiring the generation of longer nontrivial proofs for answers.&lt;br /&gt;
&lt;br /&gt;
Some ideas, including somewhat crazy ones:&lt;br /&gt;
&lt;br /&gt;
* Categorizing objects into larger categories, using the transivity of rdf:type (you have to write your own rule for the transitivity). &lt;br /&gt;
* What city/town/lake/island is inside what, according to located-in-estonia.txt. What can you derive from this, say, using transitivity of &amp;lt;i&amp;gt;inside&amp;lt;/i&amp;gt;?&lt;br /&gt;
* Who was born where and how could they potentially travel with the boat to a place another person was born :)&lt;br /&gt;
* Finding data from people-in-estonia.txt for persons active in created-in-estonia.txt. Finding people born nearby active in the same movies. Etc.&lt;br /&gt;
* Convert birth dates like &amp;lt;i&amp;gt;yago:Endel_Ruberg       schema:birthDate        &amp;quot;1917-05-21T00:00:00Z&amp;quot;^^xsd:dateTime&amp;lt;/i&amp;gt; to simple integers and use the built-in arithmetic of th e reasoner (see &amp;quot;About&amp;quot; -&amp;gt; &amp;quot;Special symbols and additional constructions&amp;quot; in logictools) to filter out suitable people. Who is surely not alive any more? Who are roughly of the same age and have something more in common?&lt;br /&gt;
* Converting triplets in the dataset &amp;lt;i&amp;gt;triple(a,b,c)&amp;lt;/i&amp;gt; where the first and second argument should conceptually strictly determine the third (like when c is a birthdate) to equalities like &amp;lt;i&amp;gt;b(a)=c&amp;lt;/i&amp;gt; instead and then using terms and equalities in your rules for such cases.&lt;br /&gt;
* Generating trips with actual paths shown in answers: you will need function term arguments in your predicates for this, see the example from the first lecture:&lt;br /&gt;
&lt;br /&gt;
  railroad(tallinn,tapa).&lt;br /&gt;
  railroad(tapa,tartu).&lt;br /&gt;
  highway(tallinn,virtsu).&lt;br /&gt;
  sealane(virtsu,kuivastu).&lt;br /&gt;
  highway(kuressaare,kuivastu).&lt;br /&gt;
  railroad(X,Y) =&amp;gt; railroad(Y,X).&lt;br /&gt;
  highway(X,Y) =&amp;gt; highway(Y,X).&lt;br /&gt;
  sealane(X,Y) =&amp;gt; sealane(Y,X).&lt;br /&gt;
  railroad(X,Y) =&amp;gt; easytravel(X,Y,use(train,X,Y)).&lt;br /&gt;
  highway(X,Y) =&amp;gt; easytravel(X,Y,use(bus,X,Y)).&lt;br /&gt;
  sealane(X,Y) =&amp;gt; easytravel(X,Y,use(ship,X,Y)).&lt;br /&gt;
  easytravel(X,Y,P1) &amp;amp; easytravel(Y,Z,P2) =&amp;gt; easytravel(X,Z,combine(P1,P2)).&lt;br /&gt;
  easytravel(tartu,X,Y) &amp;amp; spacity(X) =&amp;gt; $ans(X,Y).&lt;br /&gt;
&lt;br /&gt;
= Using large datasets: logictools vs command line reasoner gkc =&lt;br /&gt;
&lt;br /&gt;
Logictools is unable to eat very large datasets and the options to control it are limited. Also, experimenting only on the web may be cumbersome. &lt;br /&gt;
&lt;br /&gt;
Thus I&#039;d recommend to download the full-powered version of the reasoner used in logictools  from https://github.com/tammet/gkc : it is best to use the somewhat older release https://github.com/tammet/gkc/releases/tag/v0.6.0 which has the same codebase as logictools. Just take the provided windows, linux or macos binary: no need to compile yourself.&lt;br /&gt;
&lt;br /&gt;
A rather thorough tutorial of gkc with examples is README.md here: https://github.com/tammet/gkc/blob/master/Examples/README.md&lt;br /&gt;
&lt;br /&gt;
= Optional: additional datasets =&lt;br /&gt;
&lt;br /&gt;
In case you are adventurous, try to use additional datasets and combine these with the ones provided by Riina! For example, the Yago stuff contains triplets like&lt;br /&gt;
&lt;br /&gt;
  yago:Lake_Peipsi	owl:sameAs	wd:Q2627792 &lt;br /&gt;
&lt;br /&gt;
with the &amp;quot;wd:&amp;quot; defined above as &amp;quot;http://www.wikidata.org/entity/&amp;quot;, thus leading to pages like  http://www.wikidata.org/entity/Q2627792 . Now, looking at the source of this page, you find rows like &amp;lt;code&amp;gt;&amp;lt;link rel=&amp;quot;alternate&amp;quot; href=&amp;quot;https://www.wikidata.org/wiki/Special:EntityData/Q2627792.nt&amp;quot; type=&amp;quot;application/n-triples&amp;quot;&amp;gt;&amp;lt;/code&amp;gt; with the link &lt;br /&gt;
https://www.wikidata.org/wiki/Special:EntityData/Q2627792.nt leading to a large set of triplets related to Lake Peipsi! Most of these represent some specific complex encodings of this wikidata web page itself, but several are actually about Peipsi.&lt;br /&gt;
&lt;br /&gt;
A list of well-known and used large &amp;quot;generic&amp;quot; fact and knowledge bases can be found in http://lambda.ee/wiki/Teadmiste_formaliseerimine#Block_3:_General-knowledge_databases . You may want to have a look at these, but beware: obviously it takes time to understand and process. Another cool source is [https://www.kaggle.com/datasets kaggle.]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
	<entry>
		<id>http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=21967</id>
		<title>Teadmiste formaliseerimine</title>
		<link rel="alternate" type="text/html" href="http://www.lambda.ee/w/index.php?title=Teadmiste_formaliseerimine&amp;diff=21967"/>
		<updated>2025-02-12T12:13:59Z</updated>

		<summary type="html">&lt;p&gt;Riina: /* First lab */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
[[Pilt:Mephistophiles small.gif| left|teadmised]] &lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
Name: &amp;lt;b&amp;gt;Knowlege representation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Code: &amp;lt;b&amp;gt;ITI8700&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Link: http://lambda.ee/Teadmiste_formaliseerimine &amp;lt;br&amp;gt;&lt;br /&gt;
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426&amp;lt;br&amp;gt;&lt;br /&gt;
Practice sessions: Riina Maigre&amp;lt;br&amp;gt;&lt;br /&gt;
Archives of previous years: [[Teadmiste formaliseerimine 2024|2024]].&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Time, place, result =&lt;br /&gt;
&lt;br /&gt;
Lectures (Tanel): Tuesdays 14:00-15:30 room SOC 312/313 (313 weeks 1,3,5,...; 312 weeks 2,4,6,...)&amp;lt;br&amp;gt; &lt;br /&gt;
Practice sessions (Riina): Wednesdays 12:00-13:30 room U06A-204.&lt;br /&gt;
&lt;br /&gt;
The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lectures/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.&lt;br /&gt;
&lt;br /&gt;
Please join the [https://teams.microsoft.com/l/team/19%3AmRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81%40thread.tacv2/conversations?groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams] of the course. The code for joining is &lt;br /&gt;
y0bd8e5.&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566436916?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566436916&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566436916 teams link for the lecture].&lt;br /&gt;
&lt;br /&gt;
Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566518846?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&amp;amp;groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&amp;amp;parentMessageId=1738566518846&amp;amp;teamName=Knowledge%20representation%202025&amp;amp;channelName=&amp;amp;createdTime=1738566518846 teams link for the practice session].&lt;br /&gt;
&lt;br /&gt;
= Grading =&lt;br /&gt;
&lt;br /&gt;
Practical work will give 50%, exam 50% of points, and weekly tasks additional extra up to 10%, underlying the final grade. The exam will consist of (a) several questions asking for the explanation of important concepts along with examples (b) some small excercises. &lt;br /&gt;
&lt;br /&gt;
The materials below marked with the red &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; are the main materials for the exam, while &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; materials will also come up, but less and/or in a simpler form. The markings will be changed as the course progresses, i.e. the future ones will not necessarily persist!&lt;br /&gt;
&lt;br /&gt;
To finish the course successfully, you need to&lt;br /&gt;
&lt;br /&gt;
* successfully pass three practical works&lt;br /&gt;
* receive at least 1/3 of the max points at exam&lt;br /&gt;
* get practice work + weekly tasks + exam at least 50% points altogehter.&lt;br /&gt;
&lt;br /&gt;
= Contents overview: what the course is about =&lt;br /&gt;
&lt;br /&gt;
The theme of the course: &amp;lt;i&amp;gt;from SQL to natural language&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hence the main focus of the course is on hybrid methods for &lt;br /&gt;
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: [https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence symbolic AI], [https://en.wikipedia.org/wiki/Machine_learning machine learning / neural methods] and their [https://en.wikipedia.org/wiki/Neuro-symbolic_AI neurosymbolic combinations]. &lt;br /&gt;
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.&lt;br /&gt;
A closely related subject is [https://en.wikipedia.org/wiki/Commonsense_reasoning commonsense reasoning].&lt;br /&gt;
&lt;br /&gt;
The course contains the following blocks:&lt;br /&gt;
&lt;br /&gt;
* Knowledge in SQL, RDF and JSON&lt;br /&gt;
* Handling simple facts and rules in symbolic AI and logic&lt;br /&gt;
* General-knowledge databases&lt;br /&gt;
* Natural language and question answering&lt;br /&gt;
* Uncertain knowledge and hybrid systems&lt;br /&gt;
&lt;br /&gt;
= Weekly tasks =&lt;br /&gt;
&lt;br /&gt;
The small weekly tasks are in addition to the practical work: their goal is to practice with the stuff presented at the last lecture. The tasks will start from the week two; i.e. no weekly task at the first week.&lt;br /&gt;
&lt;br /&gt;
= Practical work =&lt;br /&gt;
&lt;br /&gt;
NB! The details of the labs are currently from 2024 and will be updated asap.&lt;br /&gt;
&lt;br /&gt;
There are three labs.&lt;br /&gt;
&lt;br /&gt;
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people. &lt;br /&gt;
&lt;br /&gt;
Each lab is evaluated independently and gives the same number of points. &lt;br /&gt;
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.&lt;br /&gt;
&lt;br /&gt;
== First lab ==&lt;br /&gt;
&lt;br /&gt;
The [[KR 2025 homework part 1|2025 task for the first lab]] is about handling and understanding triplet stores, meaning of rdf types/properties/etc and writing simple logical rules for answering questions. &lt;br /&gt;
&lt;br /&gt;
Lab is updated! Future updates may include clarifications, but the task itself will not change.&lt;br /&gt;
&lt;br /&gt;
Deadline: 5. March.&lt;br /&gt;
&lt;br /&gt;
== Second lab ==&lt;br /&gt;
&lt;br /&gt;
See [[Details of the KR second lab in 2025]]. This is not updated yet!&lt;br /&gt;
&lt;br /&gt;
Deadline: 9. April&lt;br /&gt;
&lt;br /&gt;
== Third lab: questions in NLP ==&lt;br /&gt;
&lt;br /&gt;
These are also not updated yet!&lt;br /&gt;
&lt;br /&gt;
* [[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]] &lt;br /&gt;
* [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]]&lt;br /&gt;
&lt;br /&gt;
Deadline: 14. May.&lt;br /&gt;
&lt;br /&gt;
= Books to use =&lt;br /&gt;
&lt;br /&gt;
Main materials:&lt;br /&gt;
&lt;br /&gt;
* Get the basic background about classical automated reasoning from the [[Media:Loogikaopik.pdf|book chapter pages 297-345]] by Tanel Tammet and optionally more details from  [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe.&lt;br /&gt;
* &amp;lt;b&amp;gt;The&amp;lt;/b&amp;gt; book for natural language (NLP): Speech and Language Processing by Dan Jurafsky and James H. Martin.  [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf here is the 2nd edition] and (suggested) [https://web.stanford.edu/~jurafsky/slp3/ here the web page for the draft 3rd edition]. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then read the appendix chapter [https://web.stanford.edu/~jurafsky/slp3/F.pdf Logical Representations of Sentence Meaning].&lt;br /&gt;
&lt;br /&gt;
Other useful books and tools for symbolic K&amp;amp;R:&lt;br /&gt;
&lt;br /&gt;
* [https://logictools.org logictools.org] for experimenting with classical automated reasoning&lt;br /&gt;
* Symbolic reasoning themes are covered in [http://www.sciencedirect.com/science/book/9781558609327 this book] with (hopefully) freely accessible pdf-s via Taltech. See also [https://www.cs.toronto.edu/~hector/PublicKRSlides.pdf slides] for the book.&lt;br /&gt;
* Similarly, the freely accessible pdf of the [https://dai.fmph.uniba.sk/~sefranek/kri/handbook/handbook_of_kr.pdf handbook of knowledge representation] &amp;lt;!-- http://ii.fmph.uniba.sk/kri/KRhandbook.pdf  --&amp;gt; gives a detailed and thorough coverage of the subject; far more than necessary for the course.&lt;br /&gt;
* You may want to get a small intro to Prolog by reading the first 100 pages of a classic [http://cdn.preterhuman.net/texts/computing/programming/Prolog/The%20Art%20of%20Prolog%20%202nd%20Ed%20-%20Leon%20Sterling%20,%20Ehud%20Shapiro.pdf Art of Prolog] book. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.&lt;br /&gt;
&lt;br /&gt;
Other useful material for neural NLP:&lt;br /&gt;
&lt;br /&gt;
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]&lt;br /&gt;
* [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]&lt;br /&gt;
* Interesting to browse: [http://www.cse.buffalo.edu/~shapiro/Courses/CSE563/Slides/krrSlides.pdf course materials], [http://web.stanford.edu/class/cs227/ course materials]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.&lt;br /&gt;
&lt;br /&gt;
= Blocks and lectures: the main content of the course =&lt;br /&gt;
&lt;br /&gt;
The details and materials of lectures in the future are from 2024 and will be revised/extended. The materials of the current or passed lectures are up to date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 1: knowledge in SQL, RDF and JSON ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro and background: 4. February ===&lt;br /&gt;
&lt;br /&gt;
Intro presentation:&lt;br /&gt;
&lt;br /&gt;
[[Media:teadmised_intro2025.pdf|teadmised_intro2025.pdf]]&lt;br /&gt;
&lt;br /&gt;
Recommended non-obligatory listening: [https://lexfridman.com/francois-chollet-2 Francois Chollet], [https://lexfridman.com/yann-lecun-2 Yann LeCun], [https://lexfridman.com/gary-marcus Gary Marcus], [https://lexfridman.com/demis-hassabis Demis Hassabis], [https://lexfridman.com/ilya-sutskever Ilya Sutskever], [https://lexfridman.com/ben-goertzel Ben Goertzel], [https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7 Tim Rocktäschel],&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Nosql, json and rdf in databases: 11. February  ===&lt;br /&gt;
&lt;br /&gt;
Lecture materials:&lt;br /&gt;
* We cover [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* and start with [[Media:Kr_lect_2b_2024.pdf| schemaless databases, RDF and RDFS]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (also important for practice work)&lt;br /&gt;
See also&lt;br /&gt;
* Json in Postgresql: [https://www.postgresql.org/docs/current/datatype-json.html json datatype] and [https://www.postgresql.org/docs/current/functions-json.html functions for json]&lt;br /&gt;
&lt;br /&gt;
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from &amp;quot;basics&amp;quot; to &amp;quot;equality&amp;quot; in simple examples selectbox. Details will appear after the lecture.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Block 2: handling simple facts and rules in symbolic AI and logic ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: simple rules in rdfs, logic and owl: 18. February ===&lt;br /&gt;
&lt;br /&gt;
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]] looked at rdfs rule meanings in logic and sparql (up to page 30 in the presentation).&lt;br /&gt;
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].&lt;br /&gt;
* [[Rdf example developed during lecture]]&lt;br /&gt;
&lt;br /&gt;
Have a brief a look at this, no need to read thoroughly:&lt;br /&gt;
&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/rdf11-primer/ rdf and rdfs primer] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main materials covered in the lecture:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And then have brief look (skim through) at:&lt;br /&gt;
* Official w3c [https://www.w3.org/TR/2012/REC-owl2-primer-20121211/ owl primer] but it is better to look at this [https://www.semantic-web-book.org/w/images/b/b0/KI09-OWL-Rules-1.pdf intro presentation] and continue with [https://www.semantic-web-book.org/w/images/5/5e/KI09-OWL-Rules-2.pdf the owl rules presentation]&lt;br /&gt;
* [https://www.stardog.com/tutorials/sparql/ sparql tutorial] and [https://en.wikipedia.org/wiki/SPARQL wikipedia take] on sparql.&lt;br /&gt;
&lt;br /&gt;
Certainly read:&lt;br /&gt;
* Hea jutt [https://twobithistory.org/2018/05/27/semantic-web.html Whatever Happened to the Semantic Web?]&lt;br /&gt;
&lt;br /&gt;
We will also start at looking and understanding the examples in [http://logictools.org logictools.org]&lt;br /&gt;
&lt;br /&gt;
More resources:&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/List_of_SPARQL_implementations sparql implementations] in wikipedia&lt;br /&gt;
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
=== Lecture: what the reasoner does: 25. February ===&lt;br /&gt;
&lt;br /&gt;
We will consider the reasoning part of K&amp;amp;R to understand what provers do:&lt;br /&gt;
* [[Media:Kr_lect_4.pdf| rules, logic, provers]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
* [http://logictools.org/ logictools] system running gkc reasoner in the browser: try out the &amp;quot;simple&amp;quot; and &amp;quot;complex&amp;quot; examples, read explanatory texts and the [http://logictools.org/about.html#basic_syntax manual about predicate logic]&lt;br /&gt;
* Have a look at the [https://github.com/tammet/gkc gkc] github repo, including precompiled binaries for command line in the [https://github.com/tammet/gkc/releases/tag/v0.6.0 release 0.6.0] and the [https://github.com/tammet/gkc/tree/v0.6.0/Examples tutorial Examples/Readme.md].&lt;br /&gt;
&amp;lt;!-- * [[Reasoner examples with gkc 2020]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; --&amp;gt;&lt;br /&gt;
* [[Travel examples from lecture 2021]]&lt;br /&gt;
&lt;br /&gt;
You may want to have a look at the additional materials - from easier to harder - from the &lt;br /&gt;
* [[Media:Loogikaopik.pdf|book chapter pages 297-345]] and optional extras, 346-382; by Tanel Tammet.&lt;br /&gt;
* [http://lambda.ee/w/images/0/06/Geoffreasoningnotes.pdf the set of course notes] from Geoff Sutcliffe, &lt;br /&gt;
* [https://resources.mpi-inf.mpg.de/departments/rg1/conferences/vtsa09/slides/schulz.pdf the implementation presentation] from Stephan Schulz &lt;br /&gt;
* [https://fmv.jku.at/rerise14/rerise14-fo-slides.pdf 5-lecture prover course] from the authors of [https://vprover.github.io/ Vampire]&lt;br /&gt;
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: looking into main large knowledge bases  ===&lt;br /&gt;
&lt;br /&gt;
Guest lecture by Martin Verrev. Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool&lt;br /&gt;
&lt;br /&gt;
You can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.&lt;br /&gt;
&lt;br /&gt;
We will have a look at the goals, main content and differences between:&lt;br /&gt;
&lt;br /&gt;
* [https://wordnet.princeton.edu/ wordnet] see [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=NLP001+0.ax tptp axioms]&lt;br /&gt;
* [https://www.dbpedia.org/ dbpedia], see also [http://mappings.dbpedia.org/server/ontology/classes/ classes] and [http://mappings.dbpedia.org/index.php/Main_Page dbpedia wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Wikidata wikidata]&lt;br /&gt;
* [https://www.mpi-inf.mpg.de/departments/databases-and-information-systems/research/yago-naga/yago/ yago old page] and [https://yago-knowledge.org/ new page]&lt;br /&gt;
* [https://babelnet.org/ babelnet] described in [https://en.wikipedia.org/wiki/BabelNet wikipedia]&lt;br /&gt;
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]&lt;br /&gt;
* [http://rtw.ml.cmu.edu/ nell website] (sometimes down) and in [https://en.wikipedia.org/wiki/Never-Ending_Language_Learning wiki] and [https://cacm.acm.org/magazines/2018/5/227193-never-ending-learning/fulltext a good paper].  &lt;br /&gt;
* [https://framenet.icsi.berkeley.edu/fndrupal/ framenet] described in [https://en.wikipedia.org/wiki/FrameNet wikipedia], see [https://framenet2.icsi.berkeley.edu/fnReports/data/lu/lu9791.xml example]&lt;br /&gt;
* [https://cyc.com cyc] but just read [https://en.wikipedia.org/wiki/Cyc wikipedia] and see [https://www.cyc.com/wp-content/uploads/2019/09/Cyc-Technology-Overview.pdf whitepaper] also [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR002+1.ax tptp small random selection of axioms]&lt;br /&gt;
* [https://adimen.si.ehu.es/web/adimenSUMO adimen-sumo] see [https://en.wikipedia.org/wiki/Suggested_Upper_Merged_Ontology sumo in wikipedia] and [http://tptp.cs.miami.edu/cgi-bin/SeeTPTP?Category=Axioms&amp;amp;File=CSR003+0.ax tptp axioms]&lt;br /&gt;
* [http://tptp.cs.miami.edu/ tptp]: a large set of axioms and problems in logic usable for automated reasoners&lt;br /&gt;
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
=== Lecture: Allen Ai research systems and Google, Facebook annotation systems  ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=3grCku Link salvestusele]. &lt;br /&gt;
&lt;br /&gt;
Examples from [https://allenai.org/ Allen Ai] research:&lt;br /&gt;
* [https://macaw.apps.allenai.org/ Macaw demo]: a predictor like GPT-3&lt;br /&gt;
* [https://proofwriter.apps.allenai.org/ Proofwriter demo]: a hybrid system (rules + predictor)  (see the [https://arxiv.org/pdf/2012.13048.pdf paper])&lt;br /&gt;
* [https://rule-reasoning.apps.allenai.org/ Rule Taker demo]: an earlier version of the Proofwriter above &lt;br /&gt;
* [https://mosaic.allenai.org/ Mosaic] commonsense reasoning&lt;br /&gt;
** [https://mosaic.allenai.org/projects/mosaic-commonsense-benchmarks SWAG benchmark dataset]&lt;br /&gt;
** [https://allenai.org/data/atomic Atomic data]&lt;br /&gt;
** [https://mosaic.allenai.org/projects/commonsense-knowledge-graphs Atomic graph explorer]&lt;br /&gt;
** [https://arxiv.org/pdf/1811.00146.pdf Atomic paper]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Google, Facebook annotation systems:&lt;br /&gt;
* [https://developers.google.com/search/docs/guides/intro-structured-data Google structured data] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; on the webpage. See also [https://en.wikipedia.org/wiki/Knowledge_Graph Google knowledge graph] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; in wikipedia.&lt;br /&gt;
* [https://developers.facebook.com/docs/sharing/webmasters/ Facebook Open Graph markup] on the webpage. See also https://ogp.me/ and the [https://en.wikipedia.org/wiki/Facebook_Graph_Search history of NLP-based ogp search]&lt;br /&gt;
&lt;br /&gt;
As a background, recall:&lt;br /&gt;
* [https://json-ld.org/ json-ld] (check out [https://json-ld.org/playground/ playground examples]) &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; currently most popular triple representation language on top of json. see also [https://en.wikipedia.org/wiki/JSON-LD wikipedia] and [https://www.w3.org/TR/json-ld11/ w3c standard]: for the latter, read [https://www.w3.org/TR/json-ld/#basic-concepts the basic concepts chapter] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;.&lt;br /&gt;
* [https://www.w3.org/TR/rdfa-primer/ rdfa] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; triple markup language suited for html, see also [https://en.wikipedia.org/wiki/RDFa wikipedia]&lt;br /&gt;
* [http://schema.org schema.org] (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; you can surf on the schema.org site and understand/find answers there)) we looked at in the last lecture: property markup vocabulary suggested by Google, Microsoft and others.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block 3: natural language and question answering ==&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Intro to NLP, n-grams, word vectors ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/Teadmiste%20loeng%205%20m%C3%A4rts-20240305_120418-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=cWEU8A&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* These three wikipages give useful introductory details:[https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]&lt;br /&gt;
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variandi draft] või [https://github.com/rain1024/slp2-pdf/blob/master/complete-book-pdf/slp2.pdf 2. variandi terve pdf]. &lt;br /&gt;
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] ja siis [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7:	Neural Networks and Neural Language Models &lt;br /&gt;
** Slaidid eelmiste peatükkide kohta: [https://web.stanford.edu/~jurafsky/slp3/slides/3_LM_Jan_08_2021.pdf Ngrams] ja [https://web.stanford.edu/~jurafsky/slp3/slides/6_Vector_Apr18_2021.pdf word vectors].&lt;br /&gt;
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].&lt;br /&gt;
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [https://beta.openai.com/ GPT-3 API beta] publicly available without a waiting period. There is also a playground on the web. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Kui tahad katsetada toore Wikipedia dataga, siis saab loengus vaadatud töödeldud variante siit (tarballid sisaldavad datat, selgitavat README-d ja tarkvara selle ise ehitamiseks): [http://turing.cs.ttu.ee/~tanel.tammet/wikicompact.tar.gz  a compacted pure-text version of full wikipedia], [http://turing.cs.ttu.ee/~tanel.tammet/wikilemma.tar.gz A lemmatized version of wikipedia texts], [http://turing.cs.ttu.ee/~tanel.tammet/wikicooccurrence.tar.gz Several co-occurrence matrices and lists of top-co-occurring words for wikipedia]&lt;br /&gt;
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
A lot of reading this week. The main material is in the following chapters 23 and 24 of the Jurafsky and Manning book, the rest is relevant overviews/background. Lecture materials for the week:&lt;br /&gt;
* Intro to the relevant parts of the whole NLP field: [[Media:Kr_lect_3a.pdf| nlp and watson]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; you may skip the watson part and read it from the following book chapter instead. These three wikipages give also useful details, but are not really necessary to read: [https://en.wikipedia.org/wiki/Natural_language_processing Natural language processing], [https://en.wikipedia.org/wiki/Knowledge_extraction Knowledge extraction], [https://en.wikipedia.org/wiki/Natural_language_understanding Natural language understanding].&lt;br /&gt;
* In case you have not studied machine learning techniques for natural language processing, read the initial parts of the [https://web.stanford.edu/~jurafsky/slp3/6.pdf chapter 6: Vector Semantics and Embeddings] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; from the Jurafsky and Martin book: this is a good background for the next two chapters 25 and 26, but not strictly necessary: we will look more into vector semantics during the next week anyway.&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/23.pdf chapter 23: Question Answering] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Recommended listening:&lt;br /&gt;
&lt;br /&gt;
* A cool 14-minute philosophy podcast episode to listen: [https://nigelwarburton.typepad.com/philosophy_bites//2015/03/jonathan-webber-on-deceiving-with-words.html Jonathan Webber on Deception With Words] plus a [http://traffic.libsyn.com/philosophybites/Jonathan_Webber_on_Deception_With_Words.mp3 a direct audio link (may expire at some point)]&lt;br /&gt;
* A bit old (i.e. few new episodes) [https://soundcloud.com/nlp-highlights NLP highlights] podcast series from the [https://allenai.org/ Allen institute for AI]. Makes sense to start from the very first ones and pick these which have a title looking interesting to you. World-leading stuff and quite understandable.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: large language models (LLM), BERT and GPT families, plus intro to second lab ===&lt;br /&gt;
&lt;br /&gt;
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&amp;amp;web=1&amp;amp;e=j8fZj2&amp;amp;nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]&lt;br /&gt;
&lt;br /&gt;
Eesmärk: saada &amp;lt;i&amp;gt;pinnaliselt&amp;lt;/i&amp;gt; aru LLM ja transformerite (NLP masinõppe põhiasjad) peamistest ideedest. Detailid on tegelikult keerulised ja nendest arusaamine võtab hulga rohkem aega, kui meil kursuses on, sestap lepime vähesega. Samas, kui sul endal huvi, siis loomulikult on teretulnud detailsem iseõpe.&lt;br /&gt;
&lt;br /&gt;
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 14 märtsi loengus.&lt;br /&gt;
&lt;br /&gt;
Loengus plaanime kasutada:&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky &amp;amp; Martin book: neural networks] and the [https://web.stanford.edu/~jurafsky/slp3/slides/7_NN_Apr_28_2021.pdf slides]. Alternative: [http://www.cs.cmu.edu/afs/cs.cmu.edu/project/theo-20/www/mlbook/ch4.pdf CMU Mitchell course: neural networks basics]&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin: transformers and LLMs]&lt;br /&gt;
* [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :)&lt;br /&gt;
&lt;br /&gt;
Mida lisaks vaadata ja lugeda:&lt;br /&gt;
&lt;br /&gt;
Kindlasti&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=kCc8FmEb1nY Andrej Karpathy progemisega-koos loeng]: vaata see süvenemisega läbi! Vt ka [https://en.wikipedia.org/wiki/Andrej_Karpathy Karpathy].&lt;br /&gt;
&lt;br /&gt;
Paratamatult jääb enamus detaile loengus vähearusaadavaks (kui ise ei kuluta hulga aega järele katsetamiseks), aga sellegipoolest on see tõenäoliselt kõige parem loeng transformeritest: mingi tunnetuse sellest, et mis toimub, saab.&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt üldisem arusaam klassikutelt:&lt;br /&gt;
&lt;br /&gt;
* [https://lexfridman.com/yann-lecun-3 Jann LeCun: värske episood Lex Fridmani podcastist]&lt;br /&gt;
* [https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/ Wolframi pikk jutt] lugemiseks koos närvivõrkudega üldisema taustaga&lt;br /&gt;
* [https://rodneybrooks.com/what-will-transformers-transform/ Rodney Brooksi] ennustused transformerite kohta&lt;br /&gt;
&lt;br /&gt;
Optsionaalselt diipim arusaam: &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/karpathy/nanoGPT nanoGPT]: [Karpathy reaalne näitekood GPT ise-ehitamiseks (otse eelmise loenguga seotud) : seda saab ilma suuremate pingutusteta käima linuxil ja macil, windowsil tekib aga suuremaid probleeme (proovisin ise linuxil järgi). &lt;br /&gt;
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi&lt;br /&gt;
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky &amp;amp; Martin ptk 10 Transformers and Pretrained Language Models] kui tahad ise juurde lugeda.&lt;br /&gt;
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].&lt;br /&gt;
&lt;br /&gt;
=== Lecture: LLM usage patterns and RAG ===&lt;br /&gt;
&lt;br /&gt;
Useful reading:&lt;br /&gt;
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]&lt;br /&gt;
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]&lt;br /&gt;
* [https://eugeneyan.com/writing/llm-patterns/ LLM improvement for applications] and a basic overview of [https://www.databricks.com/glossary/retrieval-augmented-generation-rag customizing llms]&lt;br /&gt;
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]&lt;br /&gt;
* RAG:&lt;br /&gt;
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;&lt;br /&gt;
** [https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00530/114590/Improving-the-Domain-Adaptation-of-Retrieval more rag details]: a good architecture picture, may skip the improvements part after that&lt;br /&gt;
** [https://medium.com/@evertongomede/understanding-sequence-to-sequence-seq2seq-models-and-their-significance-d2f0fd5f6f7f encoder/decoder] and [https://en.wikipedia.org/wiki/Seq2seq Seq2seq] as a generalization of [https://en.wikipedia.org/wiki/Word2vec word2vec] and [https://openai.com/blog/new-and-improved-embedding-model openai embedding model api]&lt;br /&gt;
** [https://en.wikipedia.org/wiki/Vector_database vector database] as a useful tool&lt;br /&gt;
** [https://www.promptingguide.ai/research/rag different kinds of rag] based on [https://arxiv.org/abs/2312.10997 paper]&lt;br /&gt;
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]&lt;br /&gt;
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]&lt;br /&gt;
** [https://getalign.com/ example estonian startup using a kind of rag]&lt;br /&gt;
&lt;br /&gt;
== Block 4: hybrid systems and uncertain knowledge ==&lt;br /&gt;
&lt;br /&gt;
We will focus on (a) world modeling and uncertainty in KR (open/closed world, frame problem, probabilities, exceptions) and (b) current research on building hybrid systems&lt;br /&gt;
&lt;br /&gt;
=== Lecture: neurosymbolic reasoning, open/closed world, planning, frame problem, blocks world ===&lt;br /&gt;
&lt;br /&gt;
For intro/recalling hybrid neurosymbolic reasoning:&lt;br /&gt;
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]&lt;br /&gt;
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]&lt;br /&gt;
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems]&lt;br /&gt;
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use] &lt;br /&gt;
&lt;br /&gt;
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]&lt;br /&gt;
&lt;br /&gt;
We will first give a brief overview / reminder of the work/tasks in hybrid neurosymbolic AI.&lt;br /&gt;
&lt;br /&gt;
We will then consider the issues regarding the world model and the output we expect from&lt;br /&gt;
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.&lt;br /&gt;
&lt;br /&gt;
We will then consider planning, open/closed worlds and the frame problem. The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks&lt;br /&gt;
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower&lt;br /&gt;
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a&lt;br /&gt;
required new position of blocks? Can we get the steps required? For getting the steps we&lt;br /&gt;
use the $ans predicate. &lt;br /&gt;
&lt;br /&gt;
One hard issue arising is that how do we know that doing some action&lt;br /&gt;
like lifting a block does not create side effects like stumbling existing towers, moving other&lt;br /&gt;
blocks etc? This issue is called the &amp;lt;b&amp;gt;frame problem&amp;lt;/b&amp;gt; and it has no easy solutions.&lt;br /&gt;
&lt;br /&gt;
Importantly, the frame problem arises since normal first order logic has &lt;br /&gt;
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.&lt;br /&gt;
&lt;br /&gt;
Prolog and databases operate under the &lt;br /&gt;
* [https://en.wikipedia.org/wiki/Closed-world_assumption closed world assumption] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog &amp;quot;negation&amp;quot; really means &amp;quot;cannot prove&amp;quot;. One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about &amp;quot;true&amp;quot;, &amp;quot;false&amp;quot; and &amp;quot;unknown&amp;quot;. See also [https://cliplab.org/~vocal/public_info/seminar_notes/node52.html negation as failure] in prolog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please look at and read these materials about the frame problem:&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=JzlsvFN_5HI tiny video] of the Boston Dynamics robot failing: looks like a frame problem in the blocks world :)&lt;br /&gt;
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt; must read.&lt;br /&gt;
* [https://folk.idi.ntnu.no/gamback/teaching/TDT4138/dennett84.pdf a classic AI philosophy paper] about the frame problem: must read the first three pages (rest is optional).&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Frame_problem wikipedia about frame problem]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;  skim it through (no need to read all the details) to get a rough idea about different approaches to the frame problem. None of these are really good. &lt;br /&gt;
&lt;br /&gt;
These two readings are optional:&lt;br /&gt;
* [https://plato.stanford.edu/entries/frame-problem/ frame problem] at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.&lt;br /&gt;
* [http://www-formal.stanford.edu/leora/fp.pdf another classic] about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.&lt;br /&gt;
&lt;br /&gt;
You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: [https://www.sciencedirect.com/science/article/pii/S0004370200000795/pdf?md5=31cd36929c848ce418180ff94abf4800&amp;amp;pid=1-s2.0-S0004370200000795-main.pdf see this article].&lt;br /&gt;
&lt;br /&gt;
Next, importantly, you should experiment yourself with gkc and both of the following&lt;br /&gt;
files. Please copy and read the files and understand the encoding. At the end of the files are&lt;br /&gt;
several queries to experiment with: instructions are also there.&lt;br /&gt;
&lt;br /&gt;
In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).&lt;br /&gt;
&lt;br /&gt;
* [[Simple axiomatization of the blocks world]]: &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; please also read through the comments explaining the axiomatization and queries!&lt;br /&gt;
* [[More complex blocks world axiomatization]] taken from the [http://www.tptp.org/ TPTP] problem set for first order logic, concretely by concatenanting and commenting axiom sets [[PLA001-0.ax]], [[PLA001-1.ax]] and queries [[PLA004-1.p]], [[PLA005-1.p]], [[PLA019-1.p]]&lt;br /&gt;
&lt;br /&gt;
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].&lt;br /&gt;
&lt;br /&gt;
=== Blocks world examples, then reasoning with uncertainty ===&lt;br /&gt;
&lt;br /&gt;
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.&lt;br /&gt;
&lt;br /&gt;
We will consider two different ways to tackle uncertainty:&lt;br /&gt;
* Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.&lt;br /&gt;
* Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people. &lt;br /&gt;
&lt;br /&gt;
NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.&lt;br /&gt;
&lt;br /&gt;
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; up to and including the chapter 3, see also &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; tags inside) &lt;br /&gt;
* &amp;lt;b&amp;gt;Read carefully&amp;lt;/b&amp;gt; up to and including the chapter 4 &amp;quot;Different ways to encode confidences in logic&amp;quot; and have a quick look at all the wikipedia links.&lt;br /&gt;
* Skim through the later parts and look only into these subchapters which you found interesting.&lt;br /&gt;
&lt;br /&gt;
Next, &lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about confidences. containing intro, algorithms and experiments. Then look at the [http://logictools.org/confer/ web page] with the confer reasoner and a wealth of examples.&lt;br /&gt;
* Read [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 the paper] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; about exceptions (default logic). containing intro, alorithms and experiments. Then look at the [http://logictools.org/gk/ web page] with the gk reasoner and a wealth of examples.&lt;br /&gt;
&lt;br /&gt;
Next, have a brief look at a good example system doing some specific kinds of probability reasoning:&lt;br /&gt;
* [https://dtai.cs.kuleuven.be/problog/ Problog] start with a [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: continue with uncertainty, then intro to lab 3: 9 April  ===&lt;br /&gt;
&lt;br /&gt;
Numeric confidences and probabilities.&lt;br /&gt;
&lt;br /&gt;
A [[Media:Confidences_cade28_d.pdf |presentation]] of our [https://link.springer.com/chapter/10.1007/978-3-030-79876-5_29 paper] about implementing numeric confidences. Here are [https://logictools.org/confer/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
=== Lecture: continuing with uncertain knowledge: 16 aprill ===&lt;br /&gt;
&lt;br /&gt;
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]&lt;br /&gt;
&lt;br /&gt;
A [[Media:Ijcar_2022_tammet.pdf|presentation]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; of our [https://link.springer.com/chapter/10.1007/978-3-031-10769-6_18 paper] about implementing [https://en.wikipedia.org/wiki/Default_logic default logic] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E1&amp;lt;/font&amp;gt;. Here are [https://logictools.org/gk/ examples], a binary, etc.&lt;br /&gt;
&lt;br /&gt;
Additionally, we look at non-montonic logic using [https://swish.swi-prolog.org/example/scasp.swinb s(CASP)] and [https://www.dlvsystem.it/dlvsite/ dlv]. Both are examples of [https://en.wikipedia.org/wiki/Answer_set_programming Answer set programming (ASP)] and related to [https://en.wikipedia.org/wiki/Datalog datalog]. For ASP, have a look at [https://acris.aalto.fi/ws/portalfiles/portal/30223846/SCI_Janhunen_Niemela_The_Answer_Set_Programming.pdf this intro], written by [https://www.aalto.fi/en/people/ilkka-niemela Ilkka Niemelä] who is currently the [https://www.aalto.fi/en/aalto-university/governance-president president (rehtori) of the Aalto University]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lecture: Semantic parsing  ===&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid: [[Media:KR_2024_Parsing_01.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Semantic parsing continued  ===&lt;br /&gt;
&lt;br /&gt;
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;E2&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Topics in neurosymbolic reasoning ja konsultatsioon eksamiks ===&lt;br /&gt;
&lt;br /&gt;
Some papers to explore:&lt;br /&gt;
&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper5.pdf&lt;br /&gt;
* https://ceur-ws.org/Vol-3432/paper8.pdf&lt;br /&gt;
* https://aclanthology.org/2023.emnlp-main.313.pdf&lt;br /&gt;
* https://ojs.aaai.org/index.php/AAAI/article/view/29938/31639&lt;br /&gt;
* https://arxiv.org/pdf/2404.12698&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf&lt;br /&gt;
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Kursus]]&lt;/div&gt;</summary>
		<author><name>Riina</name></author>
	</entry>
</feed>