Teadmiste formaliseerimine: erinevus redaktsioonide vahel

Allikas: Lambda
Mine navigeerimisribale Mine otsikasti
 
(ei näidata 2 kasutaja 255 vahepealset redaktsiooni)
10. rida: 10. rida:
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426<br>
Lecturer: [https://www.facebook.com/tanel.tammet Tanel Tammet] tanel.tammet@ttu.ee ICT-426<br>
Practice sessions: Riina Maigre<br>
Practice sessions: Riina Maigre<br>
Archives of previous years: [[Teadmiste formaliseerimine 2024|2024]].
Archives of previous years: [[Teadmiste formaliseerimine 2025|2025]].
</td>
</td>
</tr>
</tr>
</table>
</table>
= Eksamitulemused =
Eksamitulemused siin:
* [[Esimene (27 mai) teadmiste eksam 2026]]
* [[Teine  (1 juuni) teadmiste eksam 2026]]
* [[Kolmas  (8 juuni) teadmiste eksam 2026]]
= Eksamikonsultatsioon =
(a) väike salvestuse teamsi, teemaks siis eksamikorraldus, ülesanded jne:[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2026/Shared%20Documents/General/Recordings/Eksami%C3%BClevaate%20salvestus-20260520_053318UTC-Meeting%20Recording.mp4?csf=1&web=1&e=rQObCH&nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D salvestus siin], asub kursuse teamsi-salvestuste kataloogis.
(b) Konsultatsioonide lingid siin:
* [https://teams.microsoft.com/meet/313481263783182?p=n6Lqqc5BNDUaCUX0IJ eksamikonsultatsioon] 20. mai kell 10:30-11:00. (enne seda, kell 10:00 hajussüsteemide konsultatsioon, tolle kursuse lehel oleval lingil).
* [https://teams.microsoft.com/meet/365383768774501?p=WPjQ5sq3VKweu8doJT eksamikonsultatsioon] 25. mai kell 10:30-11:00. (enne seda, kell 10:00 hajussüsteemide konsultatsioon, tolle kursuse lehel oleval lingil).
= Eksamikorraldus ja materjalid õppimiseks =
Eksamiks on kokku aega 2.5 tundi, aga enamik peaks saama hakkama ca 1.5 tunniga.
Eksam on kirjalik, samas ruumis/ajal toimub ka hajussüsteemide kirjalik eksam.
Allolevad punase E1-ga on eksami jaoks kõige olulisemad materjalid, E2 veidi vähem olulised.
NB! Võrreldes varasemaga on lisaks markeeritud E2-ga need varasemalt olemas, aga markeerimata materjalid:
* [[Media:Llm_intro_2026.pdf|Lecture material part 1]] <font color="red">E2</font>
* [[Media:Llm_details_2026.pdf|Lecture material part 2]] <font color="red">E2</font>
* [[Media:Llm_usage_rag.pdf|Lecture material]] <font color="red">E2</font>
* [[Media:Visual Reasoning 2026.pdf|Lecture presentation]] <font color="red">E2</font>
Ekamil tuleb neli eraldi hinnatavat osa: kolm teemaküsimust ja üks osa paari lühiküsimusega. Spetsiifiliste süntaksite (RDF, loogikavarandid jne) osas: ühtegi täpset süntaksit/võtmesõnu ei pea teadma, aga esitus peab olema õppejõule sisuliselt arusaadav.
Millised on teemaküsimused ja millised on lühiküsimused:
SQL ja loogika: esitan paar tabelit ja küsin mõnda taolist küsimust:
* nende sisu võimalikult täpset esitust esimest järku loogikas või RDFs
* mõne konkreetse where- või join-päringu kirjutamist esimest järku loogikas
JSON-LD: annan JSON-LD jupi ja küsin selle tähendust ehk teisendust RDF kujule kolmikutena.
Reeglite esitamine: pane rdf ja/või rdfs kujule ja/või predikaatloogikale baseerudes kirja etteantud konkreetsed inimkeelsed väited.
Reeglite rakendamine klassikalises teoreemitõestamises: oskus teha käsitsi läbi väike resolutsioonimeetodi rakendamise näide, kui disjunktid ette antud.
Sõnavektorid ja N-grammid ja keelemudelite üldprintsiibid: arusaamine, oskus esitada väike näide töötamise kohta, võimalikud kasutus- või loomisstsenaariumd
Ebakindlate teadmiste esitamise põhimeetodid: pidevad (erinevat sorti tõenäosuste-tüüpi esitus) ja diskreetsed (eranditega süsteemid, eeskätt default logic). Siin võin tuua väikese näite ja küsida lahendust või palun ise esitada mõne pisinäite sobival kujul. Konkreetseid süntakseid teadma ei pea, piisab õppejõule arusaadavaks tegemisest.
Lühiküsimused (siit valitakse iga eksami jaoks paar):
Seleta paari lausega, mis asi on, vahel küsin ka näidet: freimiprobleem, open/closed world, blocks world, RAG, erinevad tõenäosuste interpretatsioonid, RDFa; mis asi on ja mida sealt umbes leida võib ja mida pigem mitte: schema.org, wordnet, conceptnet, yago, cyc; mida sa mäletad "semantiline parsimine" ja "visual reasoning" teemade kohta.
= Eksamipäevad ja ajad =
Siin on täpsustunud esimese kahe eksami ajad:
* 27 mai, kolmapäev, kell 11:00 (koos hajussüsteemide eksamiga). Auditoorium NRG-226.
* 1 juuni, esmaspäev: eraldi eksamiajad hajussüsteemide (11:00) ja teadmiste esitamise (14:00) jaoks. Auditoorium SOC-211a.
* 8 juuni, esmaspäev: kell 11:00 (koos hajussüsteemide eksamiga). Auditoorium ICT-315.
<!--
= <font color="red">NB! Kolmas kodutöö uuendatud</font> =
Vaata allpool "Third lab: questions in NLP": see on uuendatud 2026 aasta jaoks. Idee on analoogiline eelmise aasta ülesandega, aga konkretiseeritud piltide ülesandega (esimese ja teise kodutöö teemad) sobivaks.
-->
<!--
= <font color="red">NB! 23 ja 24 veebruar on puhkepäevad</font> =
Esmaspäev, 23. veebruar (ja ka teisipäev, 24. veebruar) on ülikoolis puhkepäevad ja õppetööd ei toimu.
-->
<!--
= <font color="red">NB! Materjalid hetkel uuendamisel</font> =
-->


= Time, place, result =
= Time, place, result =


Lectures: Tuesdays 14:00-15:30 room SOC 312/313 (313 weeks 1,3,5,...; 312 weeks 2,4,6,...)<br>  
Lectures (Tanel): Mondays 12:00-13:30 room SOC 414<br>  
Practice sessions: Wednesdays 12:00-13:30 room U06A-204.
Practice sessions (Riina): Tuesdays 08:00-09:30 room <s>MEK-122</s> MEK-109.


The lectures and sessions will be on site (physical room) plus teams. Later we may decide to do some lecturers/practice sessions on teams only: this will be advertised on the page here early. Beware: recording may not always succeed.
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.


Please join the [https://teams.microsoft.com/l/team/19%3AmRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81%40thread.tacv2/conversations?groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams] of the course. The code for joining is  
Please join the [https://teams.microsoft.com/l/team/19%3A-xXLRsURTirXcCCkQN46w4wYRJaarxbl797KeThtWXY1%40thread.tacv2/conversations?groupId=30b97413-f1b1-404d-8498-b35024d1a002&tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57 teams group] of the course. The code for joining is zb3z457.
y0bd8e5.


Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566436916?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&parentMessageId=1738566436916&teamName=Knowledge%20representation%202025&channelName=&createdTime=1738566436916 teams link for the lecture].
Weekly [https://teams.microsoft.com/meet/33688408323196?p=sd6YBPK9VZ7gRe7Zro teams link for the lecture].


Weekly [https://teams.microsoft.com/l/message/19:mRqz1VqqHQX1vt6wVM7PLFdkzAkyzDtJNmNPR-5X4y81@thread.tacv2/1738566518846?tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57&groupId=21e6505d-5451-4e56-a953-27f38cceb7b9&parentMessageId=1738566518846&teamName=Knowledge%20representation%202025&channelName=&createdTime=1738566518846 teams link for the practice session].
Weekly [https://teams.microsoft.com/meet/3558703223396?p=zc4Lgecwoy1e9Yhav9 teams link for the practice session].


= Grading =
= Grading =
33. rida: 105. rida:
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.  
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.  


The materials below marked with the red <font color="red">E1</font> are the main materials for the exam, while <font color="red">E2</font> 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!
The materials below marked with the red <font color="red">E1</font> are the main materials for the exam (10 of these on the page), while <font color="red">E2</font> materials (20 on the page) will also come up, but less and/or in a simpler form.  


To finish the course successfully, you need to
To finish the course successfully, you need to
60. rida: 132. rida:
= Weekly tasks =
= Weekly tasks =


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.
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 first weekly task ==
 
Ü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.
 
Konkreetselt tee järgmist:
* Eksperimenteeri veidi [http://logictools.org logictools.org] "simple examples" valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest.
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda).
* Kirjuta ise valmis näide vastavalt kursuse materjalile [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga "SQL join as logical rule", kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join):
<pre>
client table: id name balance
1 john 100
2 pete -200
 
cars table: id model owner
1 ford 1
2 opel 2
3 saab 2
 
select client.name, client.balance
from client where balance<0
 
select client.name, cars.model from client, cars
where client.id=cars.owner
</pre>
 
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 "answers" näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka "multiple answers" näidet.
 
* 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 "formaliseerimine", et kirja kergesti üles leiaks.
 
* Kasuta kindlasti oma taltech.ee aadressi, sest muidu võib kiri lõpetada rämpspostis!
 
Soovitused:
* 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).
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis "arithmetic" näidet.
 
 
== The second weekly task ==
 
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.
 
Vaata alustuseks json-ld näiteid [https://logictools.org/json.html logictoolsi json-tabi alt]. NB! Enamus näiteid "example" valikuboksist ei ole konventsionaalne json-ld, aga mitmed on.
 
<!--
= The first weekly task =
 
Ü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.
 
Konkreetselt tee järgmist:
* Eksperimenteeri veidi [http://logictools.org logictools.org] "simple examples" valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest.
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda).
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2024.pdf| Background: relations of sql and logic]] lk pealkirjaga "SQL join as logical rule", 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 "answers" näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka "multiple answers" näidet.
* 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 "formaliseerimine", et kirja kergesti üles leiaks.
* Kasuta saatmiseks kindlasti taltech.ee aadressi, sest muidu võib kiri minna rämpspostiks!
 
Soovitused:
* 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).
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis "arithmetic" näidet.
-->


= Practical work =
= Practical work =


NB! The details of the labs are currently from 2024 and will be updated asap.


There are three labs.
There are three labs.
75. rida: 207. rida:
== First lab ==
== First lab ==


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.


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.
Deadline: 10. March.


== Second lab ==
== Second lab ==


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.


See [[Details of the KR second lab in 2025]]
Deadline: 7. April


== Third lab: questions in NLP ==
== Third lab: questions in NLP ==


This is the task for 2026:


* [[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]]  
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner for images: 2026]]
* [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]]
 
Deadline: 12. May
 
<!--
This is an example from 2025, not the task for 2026:
[[Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner: 2025]]  
-->
<!-- * [[Use a semantic parser and a reasoner to solve questions posed in natural language: 2025]] -->
<!-- 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. -->
<!--
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&web=1&e=McaLE9&nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D 22. April lecture.]
-->


= Books to use =
= Books to use =
94. rida: 240. rida:


* 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.
* 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.
* <b>The</b> 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].
* <b>The</b> 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/ 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].


Other useful books and tools for symbolic K&R:
Other useful books and tools for symbolic K&R:
106. rida: 252. rida:


* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]
* Andrej Karpathy [https://github.com/karpathy/nanoGPT nanoGPT] and [https://github.com/karpathy/nn-zero-to-hero neural networks zero to hero course]
* [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture]
<!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT architecture] -->
<!--
<!--
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]
* Interesting to browse: [http://www.aaai.org/Library/KR/kr12contents.php recent conference proceedings]
116. rida: 262. rida:
= Blocks and lectures: the main content of the course =
= Blocks and lectures: the main content of the course =


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.
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.




== Block 1: knowledge in SQL, RDF and JSON ==
== Block 1: knowledge in SQL, RDF and JSON ==


=== Lecture: Intro and background: 4. February ===
=== Lecture: Intro and background: 2. February ===


Intro presentation:
Intro presentation:


[[Media:teadmised_intro2024.pdf|teadmised_intro2024.pdf]]
[[Media:teadmised_intro2026.pdf|teadmised_intro2026.pdf]]


Recommended non-obligatory listening:
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] -->,
* Marcus episode on the Lex Fridman podcast https://lexfridman.com/gary-marcus/
* Gary Marcus (KR&R commonsense proponent) & Joshua Bengio (ML proponent) https://www.facebook.com/watch/live/?v=498403850881660&ref=watch_permalink read also the related Marcus paper https://arxiv.org/ftp/arxiv/papers/1801/1801.00631.pdf
* David Ferrucci (IBM Watson team leader) on the Lex Fridman podcast https://lexfridman.com/david-ferrucci/
* Tim Rocktäschel (Facebook A.I.) episode https://towardsdatascience.com/language-models-symbolic-learning-and-the-road-to-agi-75725985cdf7
* Reading, not listening: on Hybrid A.I. in image analysis https://knowablemagazine.org/article/technology/2020/what-is-neurosymbolic-ai


=== Lecture: Nosql, json and rdf in databases: 11. February  ===
=== Lecture: Nosql, json and rdf in databases: 9. February  ===


Lecture materials:
Lecture materials:
144. rida: 285. rida:


The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from "basics" to "equality" in simple examples selectbox. Details will appear after the lecture.
The weekly homework will be about trying out small things in logic: please try out [http://logictools.org/ logictools] from "basics" to "equality" in simple examples selectbox. Details will appear after the lecture.


== Block 2: handling simple facts and rules in symbolic AI and logic ==
== Block 2: handling simple facts and rules in symbolic AI and logic ==




=== Lecture: simple rules in rdfs, logic and owl: 18. February ===
=== Lecture: simple rules in rdfs, logic and owl + reasoner: 16. February ===


* 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).
* Main lecture material: [[Media:Kr_lect_2b.ppt| schemaless databases, RDF and RDFS]]
<!--
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].
* [https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/EflyEjMnTMxKji6nxhy1ErUBvaUg1I749ZjrOtNYrHUynQ?e=cBfYNu 2023 Loengusalvestuse link].
* [[Rdf example developed during lecture]]
-->
[[Rdf example developed during lecture]]<font color="red">E2</font>


Have a brief a look at this, no need to read thoroughly:
Have a brief a look at this, no need to read thoroughly:
179. rida: 321. rida:
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page
* [https://www.w3.org/RDF/ various rdf tools] listed at the bottom of the page


=== Lecture: what the reasoner does: 25. February ===
What the reasoner does:


We will consider the reasoning part of K&R to understand what provers do:
We will consider the reasoning part of K&R to understand what provers do:
195. rida: 337. rida:
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.
* and the readable-and-hackable [https://github.com/eprover/PyRes PyRes reasoner] for educational use.


=== Lecture: DPP ontology development. 2. March ===


=== Lecture: looking into main large knowledge bases  ===
Loengu annab Riina. Digital Product Passport (DPP)
kui näide praktilisest ontoloogia/sõnastiku arendamisest [https://cirpassproject.eu/dpp-in-a-nutshell/ CIRPASS] projektis.


Guest lecture by Martin Verrev. Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] <font color="red">E2</font>, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool
[https://dpp.vocabulary-hub.eu/ Hetkeseisu algusleht].
 
[https://cirpass2.eu/ CIRPASS-2]
 
[https://si-digital-framework.org/SI/units?lang=en Ühikute ontoloogia]
 
[https://www.w3.org/TR/shacl/ SHACL]
 
[https://untp.unece.org/docs/specification/DigitalProductPassport/ UNTP DPP]
 
 
 
<!--
 
=== Lecture: what the reasoner does: märtsi algul ===
-->
<!--
<font color="red">NB!</font>This lecture will be the following recording from 2024 pluss self-study reading and experiments only, not in the lecture room:
-->
<!--
 
[http://turing.cs.ttu.ee/~tanel.tammet/reasoning_engines_recording_2024.mp4 Recording]
-->
 
=== Lecture: Next homework and looking into main large knowledge bases: 9. March  ===
 
We will first present the next homework.
 
Then we will continue with existing large knowledge bases.
 
Slides:[[Media:ITI8700_05_Large_KB.pdf|lecture slides]] <font color="red">E2</font>, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool


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.
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.
About knowlege base creation using LLMs: have a look at [https://arxiv.org/html/2411.04920v1 this paper].


We will have a look at the goals, main content and differences between:
We will have a look at the goals, main content and differences between:
211. rida: 387. rida:
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]
* [http://conceptnet5.media.mit.edu/ conceptnet] described in [https://en.wikipedia.org/wiki/Open_Mind_Common_Sense wikipedia]
* [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].   
* [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].   
* [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]
* [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]
* [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&File=CSR002+1.ax tptp small random selection of axioms]
* [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&File=CSR002+1.ax tptp small random selection of axioms]
* [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&File=CSR003+0.ax tptp axioms]
* [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&File=CSR003+0.ax tptp axioms]
* [http://tptp.cs.miami.edu/ tptp]: a large set of axioms and problems in logic usable for automated reasoners
* [https://www.tptp.org/ tptp]: a large set of axioms and problems in logic usable for automated reasoners
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.
* [http://schema.org schema.org]: property markup vocabulary suggested by Google, Microsoft and others.
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]
* [https://reference.wolfram.com/language/guide/KnowledgeRepresentationAndAccess.html Wolfram alpha stuff]
246. rida: 422. rida:
== Block 3: natural language and question answering ==
== Block 3: natural language and question answering ==


=== Lecture: Intro to NLP, n-grams, word vectors ===
=== Lecture: Intro to NLP, n-grams, word vectors: 16 March ===


<!--
[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&web=1&e=cWEU8A&nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]
[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&web=1&e=cWEU8A&nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D Loengusalvestus teamsis]
-->
<!--
<!--
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]
[https://livettu.sharepoint.com/:v:/s/Knowledgerepresentation2023/Ea7HdMQxBcBGlSqBi18ZC2cBg7HU371GuQOVkdvkDjnyVg?e=PNaowE Loengusalvestus]
255. rida: 433. rida:
* 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].
* 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].
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] <font color="red">E1</font> ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]
* Tanel Alumäe keelemudelitesse [http://lambda.ee/w/images/1/13/Keelemudelid.pdf sissejuhatavad slaidid] <font color="red">E1</font> ja [https://echo360.org.uk/media/e4323062-3442-46fb-9124-e7b9e7d00006/public loengusalvestus]
* 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].  
* Väga hea õpik: [https://web.stanford.edu/~jurafsky/slp3/ 3. variant].  
** 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] <font color="red">E2</font>. Vektorsemantika kasutamine närvivõrkudes a la Bert ja GPT on hästi kirjas ptks 7: Neural Networks and Neural Language Models
** Vektorsemantikast arusaamiseks loe 3. variandi [https://web.stanford.edu/~jurafsky/slp3/3.pdf ptk 3. N-gram Language Models] <font color="red">E2</font> ja siis [https://web.stanford.edu/~jurafsky/slp3/5.pdf chapter 5: Embeddings] <font color="red">E2</font>. Vaata [https://web.stanford.edu/~jurafsky/slp3/ sisukorrast] ka slaide nende kohta.
** 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].
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].
* Google [https://books.google.com/ngrams/info ngrams] ja [https://storage.googleapis.com/books/ngrams/books/datasetsv3.html reaalne data].
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation
* [https://nlp.stanford.edu/projects/glove/ GloVE]: a relatively simple vector representation
264. rida: 441. rida:
-->
-->
* 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]
* 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]
* Online [http://text-processing.com/demo/ demo] of NTLK running some basic NLP tasks
<!--
<!--
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:
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:
272. rida: 448. rida:
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] <font color="red">E2</font>and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]
* Read from the Jurafsky and Martin book: [https://web.stanford.edu/~jurafsky/slp3/24.pdf chapter 24: Dialogue Systems and Chatbots] <font color="red">E2</font>and the supporting slides [https://web.stanford.edu/~jurafsky/slp3/slides/convagents1.pdf for conversational agents]
-->
-->
 
<!--
Recommended listening:
Recommended listening:


* 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)]
* 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)]
* 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.
* 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.
-->
* Loengus tehtud [[katse Glove vektoritega]] [https://medium.com/analytics-vidhya/basics-of-using-pre-trained-glove-vectors-in-python-d38905f356db selle jutu] järgi.


=== Lecture: large language models (LLM), BERT and GPT families, plus intro to second lab ===
=== Lecture: large language models (LLM) 23 March ===


* [[Media:Llm_intro_2026.pdf|Lecture material part 1]] <font color="red">E2</font>
* [[Media:Llm_details_2026.pdf|Lecture material part 2]] <font color="red">E2</font>
<!--
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&web=1&e=j8fZj2&nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2024/Shared%20Documents/General/Recordings/New%20channel%20meeting-20240312_120339-Meeting%20Recording.mp4?csf=1&web=1&e=j8fZj2&nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D loengusalvestus koos teise praksi ülesannetega]
-->


Eesmärk: saada <i>pinnaliselt</i> 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.
Eesmärk: saada <i>pinnaliselt</i> 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.


Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 14 märtsi loengus.
Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.


Loengus plaanime kasutada:
Mida vaadata ja lugeda:
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky & 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]
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky & Martin: transformers and LLMs]
* [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :)


Mida lisaks vaadata ja lugeda:
Eriti soovitav
 
Kindlasti


* [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].
* [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].


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.
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.
Pikemaks lugemiseks:
* [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]
* [https://web.stanford.edu/~jurafsky/slp3/7.pdf Jurafsky & 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]
* [https://web.stanford.edu/~jurafsky/slp3/9.pdf Jurafsky & Martin: chapter 9, transformers ]
<!-- * [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky & Martin: chapter 10, transformers and LLMs] -->
<!-- * [https://dugas.ch/artificial_curiosity/GPT_architecture.html GPT arhitektuuri üldseletus]: eriti head intuitsiooni ei maksa loota :) -->


Optsionaalselt üldisem arusaam klassikutelt:
Optsionaalselt üldisem arusaam klassikutelt:
309. rida: 495. rida:
* [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).  
* [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).  
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi
* [https://karpathy.ai/zero-to-hero.html Taustaks: Karpathy terve loenguseeria], kui sul tekib sügavam huvi
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky & Martin ptk 10 Transformers and Pretrained Language Models] kui tahad ise juurde lugeda.
* [https://web.stanford.edu/~jurafsky/slp3/10.pdf Jurafsky & Martin ptk 10 Large Language Models] kui tahad ise juurde lugeda.
* Good free (?) book:  [https://www.manning.com/books/build-a-large-language-model-from-scratch Build a Large Language Model (From Scratch)]
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].
* [https://course.fast.ai/ väga detailne ja mahukas videoloengutega deep learningu kursus], mh [https://course.fast.ai/Resources/book.html raamat].


=== Lecture: LLM usage patterns and RAG ===
=== Lecture: RAG usage pattern / context engineering for LLMs : 30 March ===


Useful reading:
[[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.
 
<b>"Context Engineering"</b> became a popular phrase in 2025: essentially it means "fancy RAG", i.e. significant effort put towards creating a really good set of additional information (prompt additions: "context") for each user query/prompt. It can also mean approaches for storing such additional information on the fly in special files which
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].
 
Useful reading in addition to pointers in the lecture material:
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]
* [https://pixelplex.io/blog/llm-applications/ application landscape overview]
* early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use]
<!-- * early taxonomy [https://arxiv.org/pdf/2311.05288.pdf of real business use] -->
* [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]
* 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]
* [https://www.anyscale.com/blog/fine-tuning-llama-2-a-comprehensive-case-study-for-tailoring-models-to-unique-applications Finetuning llama 2]
* 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]
* RAG:
* RAG:
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] <font color="red">E1</font>
** [https://colabdoge.medium.com/what-is-rag-retrieval-augmented-generation-b0afc5dd5e79 simplest RAG intro] <font color="red">E1</font>
** [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
** [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
** [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]
** [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]
** [https://en.wikipedia.org/wiki/Vector_database vector database] as a useful tool
** [https://en.wikipedia.org/wiki/Vector_database vector database] <font color="red">E2</font> as a useful tool
** [https://www.promptingguide.ai/research/rag different kinds of rag] based on [https://arxiv.org/abs/2312.10997 paper]
** [https://www.promptingguide.ai/research/rag different kinds of rag] <font color="red">E2</font> based on [https://arxiv.org/abs/2312.10997 paper]
<!--
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]
** [https://python.langchain.com/docs/expression_language/cookbook/retrieval rag by langchain]
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]
** [https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html a fancy rag paper]
** [https://getalign.com/ example estonian startup using a kind of rag]
-->
<!-- ** [https://getalign.com/ example estonian startup using a kind of rag] -->


== Block 4: hybrid systems and uncertain knowledge ==
== Block 4: hybrid systems and uncertain knowledge ==
333. rida: 527. rida:
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
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


=== Lecture: neurosymbolic reasoning, open/closed world, planning, frame problem, blocks world ===
=== Lecture: issues in formalizing commonsense reasoning: open/closed world, frame problem, uncertainties: 6. April ===
 
<!--
<i>First, some results/challenges in neurosymbolic reasoning.</i>


For intro/recalling hybrid neurosymbolic reasoning:
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]
* [https://arxiv.org/pdf/2301.13379.pdf generating computation tasks]
* [https://github.com/tammet/llmlog our current experiments in reasoning with LLM]
* [https://onlinelibrary.wiley.com/doi/full/10.1111/cogs.13432 neurosymbolic Bongard]
* [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]
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]
* [https://deepmind.google/discover/blog/alphageometry-an-olympiad-level-ai-system-for-geometry/ alphageometry]
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems]
* [https://arxiv.org/pdf/2402.01817.pdf a position paper on hybrid systems] <font color="red">E2</font>
-->
<!--
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use]  
* [https://arxiv.org/pdf/2302.07842.pdf a large survey of tool use]  
 
-->
<!--
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]
See also an [https://adamkarvonen.github.io/machine_learning/2024/01/03/chess-world-models.html interesting recent piece about learning chess]


347. rida: 549. rida:
We will then consider the issues regarding the world model and the output we expect from
We will then consider the issues regarding the world model and the output we expect from
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.
the neural part / LLM, along with some demonstrations of semantic parsing with and without the use of LLM.
-->


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
 
<b><i>First, open/closed world, world states, frame problem</i></b>
 
The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower
and put them on other blocks or on the table. The arm cannot lift several blocks or a tower
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a
of blocks. Then, given a position of blocks at initial situation, can the robot arm create a
359. rida: 565. rida:


Importantly, the frame problem arises since normal first order logic has  
Importantly, the frame problem arises since normal first order logic has  
* the [https://en.wikipedia.org/wiki/Open-world_assumption open world assumption] <font color="red">E1</font> (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.
* the <i>open world assumption</i>: 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.


Prolog and databases operate under the  
Prolog and databases operate under the  
366. rida: 572. rida:


Please look at and read these materials about the frame problem:
Please look at and read these materials about the frame problem:
 
<!--
* [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 :)
* [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 :)
-->
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: <font color="red">E1</font> must read.
* [https://people.cs.pitt.edu/~milos/courses/cs2740/Lectures/class14.pdf overview presentation]: <font color="red">E1</font> must read.
* [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).
* [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).
380. rida: 587. rida:
Next, importantly, you should experiment yourself with gkc and both of the following
Next, importantly, you should experiment yourself with gkc and both of the following
files. Please copy and read the files and understand the encoding. At the end of the files are
files. Please copy and read the files and understand the encoding. At the end of the files are
several queries to experiment with: instructions are also there.
several queries to experiment with: instructions are also there. The simplest way to experiment is to use https://logictools.org/ . There is already a <b>blocks world</b> example available.


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).
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).
389. rida: 596. rida:
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].
To get a simple visualization of the blocks world, have a look at this [https://www.youtube.com/watch?v=gbIPicRoIgQ tiny video].


=== Blocks world examples, then reasoning with uncertainty ===
 
<b><i>Second, uncertainty</i></b>
 


Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] <font color="red">E1</font>.
Loengu sissejuhatava osa presentatsioon: [[Media:Reasoning_with_uncertainty.pdf|Reasoning_with_uncertainty.pdf]] <font color="red">E1</font>.
402. rida: 611. rida:


The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (<font color="red">E2</font> up to and including the chapter 3, see also <font color="red">E2</font> tags inside)  
The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer [[Numeric uncertainty]]: (<font color="red">E2</font> up to and including the chapter 3, see also <font color="red">E2</font> tags inside)  
* <b>Read carefully</b> up to and including the chapter 4 "Different ways to encode confidences in logic" and have a quick look at all the wikipedia links.
* <b>Read carefully</b> up to and including the chapter 4 "Different ways to encode confidences in logic" 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]
* Skim through the later parts and look only into these subchapters which you found interesting.
* Skim through the later parts and look only into these subchapters which you found interesting.


413. rida: 622. rida:
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]
* Try out some examples via browser from the [https://dtai.cs.kuleuven.be/problog/tutorial.html tutorial]


=== Lecture: research in neurosymbolic reasoning: 13 April ===
[[Media:Research_in_Neurosymbolic_Reasoning.pdf|lecture slides]]
The lecture will be given by our PhD student [https://aire-edih.eu/meeskond/otto-mattas/ Otto Mättas].
=== Lecture: semantic parsing with LLMs and with UDP: 20 April ===
The focus of the lecture is on [https://en.wikipedia.org/wiki/Semantic_parsing semantic parsing].
For a quick intro we will use Martin's slides from 2024 [[Media:KR_2024_Parsing_01.pdf|semantic parsing]] <font color="red">E2</font>.
The rest of the lecture will explain stuff in [https://github.com/tammet/nlpsolver nlpsolver]. See the [[Media:Nlpsolver_presentation.pdf|nlpsolver presentation]].
Useful background:
About important concepts in parsing:
* [https://en.wikipedia.org/wiki/Part_of_speech Part-Of-Speech (POS)] and [https://en.wikipedia.org/wiki/Part-of-speech_tagging POS tagging]
* [https://web.stanford.edu/~jurafsky/slp3/18.pdf Jurafsky&Martin: Constituency Parsing]
* [https://web.stanford.edu/~jurafsky/slp3/19.pdf Jurafsky&Martin: Dependency Parsing]
Some important toolkits and representation schemes:
* [https://spacy.io spacy], [[a small spacy UD parsing example]]
* [https://stanfordnlp.github.io/stanza/ stanza]
* [https://universaldependencies.org/ universal dependencies]
Some draft parsing papers:
* [[Media:concepts_draft_paper.pdf|concepts, based on UD]]
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]
=== Lecture: we explore some recent papers in neurosymbolic reasoning: 27 April  ===
A reading session: we will read and attempt to understand together some case studies.
* Google DeepMind paper [https://www.nature.com/articles/s41586-023-06747-5 Solving olympiad geometry without human demonstrations]
* Google DeepMind paper [https://www.nature.com/articles/s41586-025-09833-y Olympiad-level formal mathematical reasoning with reinforcement learning]
* [https://arxiv.org/abs/2502.13834 Proving Olympiad Inequalities by Synergizing LLMs and Symbolic Reasoning]
* [https://arxiv.org/abs/2511.11751 Concept-RuleNet: Grounded Multi-Agent Neurosymbolic Reasoning in Vision Language Models]
* [https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf What’s Left?Concept Grounding with Logic-Enhanced Foundation Models]
=== Lecture: visual reasoning: 4. May  ===
The lecture will be given by our postdoc researcher [https://vaishnavmohit.github.io/ Mohit Vaishnav].
[[Media:Visual Reasoning 2026.pdf|Lecture presentation]] <font color="red">E2</font>
Related preprints:
* [https://arxiv.org/pdf/2501.13620 Cognitive paradigms for evaluating vlms on visual reasoning task]
* [https://arxiv.org/pdf/2604.21346 Symbolic Grounding Reveals Representational Bottlenecks in Abstract Visual Reasoning]


=== Lecture: continue with uncertainty, then intro to lab 3: 9 April ===
=== Lecture: we continue exploring recent papers in neurosymbolic reasoning: 11 May ===


Numeric confidences and probabilities.
We look at some of the more interesting papers from each subarea (maybe not all the papers):
 
Logic focus:
* Neuro-Symbolic Concepts https://arxiv.org/pdf/2505.06191
* Sound and Complete Neurosymbolic Reasoning with LLM-Grounded Interpretations https://arxiv.org/pdf/2507.09751
 
Visual reasoning:
* MuSLR: Multimodal Symbolic Logical Reasoning https://arxiv.org/pdf/2509.25851
* Can VLMs Reason Robustly? A Neuro-Symbolic Investigation https://arxiv.org/pdf/2603.23867
 
Planning:
* LLMs as Planning Formalizers: A Survey for Leveraging Large Language Models to Construct Automated Planning Models https://arxiv.org/pdf/2503.18971
* Planning in the Dark: LLM-Symbolic Planning Pipeline without Experts https://arxiv.org/pdf/2409.15915 or newer https://ojs.aaai.org/index.php/AAAI/article/view/34855/37010
* Fast and Accurate Task Planning using Neuro-Symbolic Language Models and Multi-level Goal Decomposition https://arxiv.org/pdf/2409.19250
* See also PDDL https://fareskalaboud.github.io/LearnPDDL/ https://homepages.inf.ed.ac.uk/mfourman/tools/propplan/pddl.pdf
 
Text-to-SQL:
* SPIDER 2.0: EVALUATING LANGUAGE MODELS ON REAL-WORLD ENTERPRISE TEXT-TO-SQL WORKFLOWS https://arxiv.org/pdf/2411.07763
* CHASE-SQL: Multi-Path Reasoning and Preference Optimized Candidate Selection in Text-to-SQL https://arxiv.org/pdf/2410.01943
 
=== Consultation for the exam: 18 May  ===
 
 
 
<!--
[[Media:Research_in_Neurosymbolic_Reasoning.pdf|lecture slides]]
 
The lecture will be given by our PhD student [https://aire-edih.eu/meeskond/otto-mattas/ Otto Mättas].
-->
<!--
=== Lecture: visual reasoning  ===
 
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.
 
=== Lecture: third lab live experiments ===
 
We will do live experiments for the third lab.
 
Previous plan was: continue with uncertainty, numeric confidences and probabilities.


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.
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.
 
-->
=== Lecture: continuing with uncertain knowledge: 16 aprill ===
<!--
=== Lecture: continuing with uncertain knowledge ===


Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]
Wider background: [https://en.wikipedia.org/wiki/Non-monotonic_logic non-monotonic logic]
427. rida: 726. rida:


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]
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]
-->
<!--
=== Lecture: Semantic parsing  ===


The focus of the lecture is on [https://en.wikipedia.org/wiki/Semantic_parsing semantic parsing].


=== Lecture: Semantic parsing  ===
Here are Martin's slides from 2024 [[Media:KR_2024_Parsing_01.pdf]] <font color="red">E2</font>.
 
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.
 
About important concepts in parsing:
* [https://en.wikipedia.org/wiki/Part_of_speech Part-Of-Speech (POS)] and [https://en.wikipedia.org/wiki/Part-of-speech_tagging POS tagging]
* [https://web.stanford.edu/~jurafsky/slp3/18.pdf Jurafsky&Martin: Constituency Parsing]
* [https://web.stanford.edu/~jurafsky/slp3/19.pdf Jurafsky&Martin: Dependency Parsing]


Loenguslaidid: [[Media:KR_2024_Parsing_01.pdf]] <font color="red">E2</font>
Some important toolkits and representation schemes:
* [https://spacy.io spacy], [[a small spacy UD parsing example]]
* [https://stanfordnlp.github.io/stanza/ stanza]
* [https://universaldependencies.org/ universal dependencies]


Some draft parsing papers:
* [[Media:concepts_draft_paper.pdf|concepts, based on UD]]
* [[Media:pipeline_draft_paper.pdf|pipeline, based on UD]]
* [[Media:llm_parser_draft_paper.pdf|experiments with LLM usage]]
-->
<!--
=== Semantic parsing continued  ===
=== Semantic parsing continued  ===
Lecture will be given by Martin Verrev on teams only (not the lecture room).


Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] <font color="red">E2</font>
Loenguslaidid (lisatud linkidega): [[Media:KR_2024_Parsing_02.pdf]] <font color="red">E2</font>
-->


 
<!--
=== Topics in neurosymbolic reasoning ja konsultatsioon eksamiks ===
=== Topics in neurosymbolic reasoning and consultation for the exam  ===
 
-->
<!--
Some papers to explore:
Some papers to explore:


450. rida: 774. rida:
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf
* https://proceedings.neurips.cc/paper_files/paper/2023/file/79fea214543ba263952ac3f4e5452b14-Paper-Conference.pdf
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf
* https://proceedings.neurips.cc/paper_files/paper/2023/file/ba90e56a74fd77d0ddec033dc199f0fa-Paper-Conference.pdf
 
-->




[[Category:Kursus]]
[[Category:Kursus]]

Viimane redaktsioon: 12. juuni 2026, kell 22:19

teadmised
teadmised

Name: Knowlege representation
Code: ITI8700
Link: http://lambda.ee/Teadmiste_formaliseerimine
Lecturer: Tanel Tammet tanel.tammet@ttu.ee ICT-426
Practice sessions: Riina Maigre
Archives of previous years: 2025.

Eksamitulemused

Eksamitulemused siin:

Eksamikonsultatsioon

(a) väike salvestuse teamsi, teemaks siis eksamikorraldus, ülesanded jne:salvestus siin, asub kursuse teamsi-salvestuste kataloogis.

(b) Konsultatsioonide lingid siin:

  • eksamikonsultatsioon 20. mai kell 10:30-11:00. (enne seda, kell 10:00 hajussüsteemide konsultatsioon, tolle kursuse lehel oleval lingil).
  • eksamikonsultatsioon 25. mai kell 10:30-11:00. (enne seda, kell 10:00 hajussüsteemide konsultatsioon, tolle kursuse lehel oleval lingil).

Eksamikorraldus ja materjalid õppimiseks

Eksamiks on kokku aega 2.5 tundi, aga enamik peaks saama hakkama ca 1.5 tunniga.

Eksam on kirjalik, samas ruumis/ajal toimub ka hajussüsteemide kirjalik eksam.

Allolevad punase E1-ga on eksami jaoks kõige olulisemad materjalid, E2 veidi vähem olulised. NB! Võrreldes varasemaga on lisaks markeeritud E2-ga need varasemalt olemas, aga markeerimata materjalid:

Ekamil tuleb neli eraldi hinnatavat osa: kolm teemaküsimust ja üks osa paari lühiküsimusega. Spetsiifiliste süntaksite (RDF, loogikavarandid jne) osas: ühtegi täpset süntaksit/võtmesõnu ei pea teadma, aga esitus peab olema õppejõule sisuliselt arusaadav. Millised on teemaküsimused ja millised on lühiküsimused:

SQL ja loogika: esitan paar tabelit ja küsin mõnda taolist küsimust:

  • nende sisu võimalikult täpset esitust esimest järku loogikas või RDFs
  • mõne konkreetse where- või join-päringu kirjutamist esimest järku loogikas

JSON-LD: annan JSON-LD jupi ja küsin selle tähendust ehk teisendust RDF kujule kolmikutena.

Reeglite esitamine: pane rdf ja/või rdfs kujule ja/või predikaatloogikale baseerudes kirja etteantud konkreetsed inimkeelsed väited.

Reeglite rakendamine klassikalises teoreemitõestamises: oskus teha käsitsi läbi väike resolutsioonimeetodi rakendamise näide, kui disjunktid ette antud.

Sõnavektorid ja N-grammid ja keelemudelite üldprintsiibid: arusaamine, oskus esitada väike näide töötamise kohta, võimalikud kasutus- või loomisstsenaariumd

Ebakindlate teadmiste esitamise põhimeetodid: pidevad (erinevat sorti tõenäosuste-tüüpi esitus) ja diskreetsed (eranditega süsteemid, eeskätt default logic). Siin võin tuua väikese näite ja küsida lahendust või palun ise esitada mõne pisinäite sobival kujul. Konkreetseid süntakseid teadma ei pea, piisab õppejõule arusaadavaks tegemisest.

Lühiküsimused (siit valitakse iga eksami jaoks paar):

Seleta paari lausega, mis asi on, vahel küsin ka näidet: freimiprobleem, open/closed world, blocks world, RAG, erinevad tõenäosuste interpretatsioonid, RDFa; mis asi on ja mida sealt umbes leida võib ja mida pigem mitte: schema.org, wordnet, conceptnet, yago, cyc; mida sa mäletad "semantiline parsimine" ja "visual reasoning" teemade kohta.

Eksamipäevad ja ajad

Siin on täpsustunud esimese kahe eksami ajad:

  • 27 mai, kolmapäev, kell 11:00 (koos hajussüsteemide eksamiga). Auditoorium NRG-226.
  • 1 juuni, esmaspäev: eraldi eksamiajad hajussüsteemide (11:00) ja teadmiste esitamise (14:00) jaoks. Auditoorium SOC-211a.
  • 8 juuni, esmaspäev: kell 11:00 (koos hajussüsteemide eksamiga). Auditoorium ICT-315.


Time, place, result

Lectures (Tanel): Mondays 12:00-13:30 room SOC 414
Practice sessions (Riina): Tuesdays 08:00-09:30 room MEK-122 MEK-109.

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.

Please join the teams group of the course. The code for joining is zb3z457.

Weekly teams link for the lecture.

Weekly teams link for the practice session.

Grading

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.

The materials below marked with the red E1 are the main materials for the exam (10 of these on the page), while E2 materials (20 on the page) will also come up, but less and/or in a simpler form.

To finish the course successfully, you need to

  • successfully pass three practical works
  • receive at least 1/3 of the max points at exam
  • get practice work + weekly tasks + exam at least 50% points altogehter.

Contents overview: what the course is about

The theme of the course: from SQL to natural language.

Hence the main focus of the course is on hybrid methods for knowledge representation and reasoning: symbolic AI, machine learning / neural methods and their neurosymbolic combinations. 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. A closely related subject is commonsense reasoning.

The course contains the following blocks:

  • Knowledge in SQL, RDF and JSON
  • Handling simple facts and rules in symbolic AI and logic
  • General-knowledge databases
  • Natural language and question answering
  • Uncertain knowledge and hybrid systems

Weekly tasks

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 first weekly task

Ülesanne on eksperimenteerida veidi logictools.org saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 17. veebruar.

Konkreetselt tee järgmist:

  • Eksperimenteeri veidi logictools.org "simple examples" valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest.
  • Loe seejuures predikaatloogika väikest seletust about lehel kuni lausearvutuseni (seda pole enam otse vaja lugeda).
  • Kirjuta ise valmis näide vastavalt kursuse materjalile Background: relations of sql and logic lk pealkirjaga "SQL join as logical rule", kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join):
client table: id name balance
1 john 100 
2 pete -200

cars table: id model owner
1 ford 1
2 opel 2
3 saab 2

select client.name, client.balance
from client where balance<0

select client.name, cars.model from client, cars
where client.id=cars.owner

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 "answers" näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka "multiple answers" näidet.

  • 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 "formaliseerimine", et kirja kergesti üles leiaks.
  • Kasuta kindlasti oma taltech.ee aadressi, sest muidu võib kiri lõpetada rämpspostis!

Soovitused:

  • 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).
  • Aritmeetika jaoks vaata help teksti Arithmetic peatükki.
  • Väiksem-tingimuse jaoks vaata complex examples valikuboksis "arithmetic" näidet.


The second weekly task

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.

Vaata alustuseks json-ld näiteid logictoolsi json-tabi alt. NB! Enamus näiteid "example" valikuboksist ei ole konventsionaalne json-ld, aga mitmed on.


Practical work

There are three labs.

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.

Each lab is evaluated independently and gives the same number of points. NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.

First lab

The 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.

Deadline: 10. March.

Second lab

The 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.

Deadline: 7. April

Third lab: questions in NLP

This is the task for 2026:

Experiment with neurosymbolic reasoning: LLM as a parser plus a symbolic reasoner for images: 2026

Deadline: 12. May


Books to use

Main materials:

Other useful books and tools for symbolic K&R:

  • logictools.org for experimenting with classical automated reasoning
  • Symbolic reasoning themes are covered in this book with (hopefully) freely accessible pdf-s via Taltech. See also slides for the book.
  • Similarly, the freely accessible pdf of the handbook of knowledge representation gives a detailed and thorough coverage of the subject; far more than necessary for the course.
  • You may want to get a small intro to Prolog by reading the first 100 pages of a classic 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.

Other useful material for neural NLP:

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.

Blocks and lectures: the main content of the course

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.


Block 1: knowledge in SQL, RDF and JSON

Lecture: Intro and background: 2. February

Intro presentation:

teadmised_intro2026.pdf

Recommended non-obligatory listening: Francois Chollet, Yann LeCun, Gary Marcus, Demis Hassabis, Ilya Sutskever, Ben Goertzel ,

Lecture: Nosql, json and rdf in databases: 9. February

Lecture materials:

See also

The weekly homework will be about trying out small things in logic: please try out logictools from "basics" to "equality" in simple examples selectbox. Details will appear after the lecture.

Block 2: handling simple facts and rules in symbolic AI and logic

Lecture: simple rules in rdfs, logic and owl + reasoner: 16. February

Rdf example developed during lectureE2

Have a brief a look at this, no need to read thoroughly:

The main materials covered in the lecture:


And then have brief look (skim through) at:

Certainly read:

We will also start at looking and understanding the examples in logictools.org

More resources:

What the reasoner does:

We will consider the reasoning part of K&R to understand what provers do:

You may want to have a look at the additional materials - from easier to harder - from the

Lecture: DPP ontology development. 2. March

Loengu annab Riina. Digital Product Passport (DPP) kui näide praktilisest ontoloogia/sõnastiku arendamisest CIRPASS projektis.

Hetkeseisu algusleht.

CIRPASS-2

Ühikute ontoloogia

SHACL

UNTP DPP



Lecture: Next homework and looking into main large knowledge bases: 9. March

We will first present the next homework.

Then we will continue with existing large knowledge bases.

Slides:lecture slides E2, a tool to explore Wordnet taxonomies can be found here: https://github.com/martinve/wntool

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.

About knowlege base creation using LLMs: have a look at this paper.

We will have a look at the goals, main content and differences between:


Block 3: natural language and question answering

Lecture: Intro to NLP, n-grams, word vectors: 16 March

Lecture: large language models (LLM) 23 March


Eesmärk: saada pinnaliselt 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.

Enne järgmisse materjali süvenemist tutvu kindlasti vektorsemantikaga, mida seletasime 11 märtsi loengus.

Mida vaadata ja lugeda:

Eriti soovitav

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.

Pikemaks lugemiseks:


Optsionaalselt üldisem arusaam klassikutelt:

Optsionaalselt diipim arusaam:

Lecture: RAG usage pattern / context engineering for LLMs : 30 March

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.

"Context Engineering" became a popular phrase in 2025: essentially it means "fancy RAG", i.e. significant effort put towards creating a really good set of additional information (prompt additions: "context") for each user query/prompt. It can also mean approaches for storing such additional information on the fly in special files which are then used RAG-like as extra input in addition to user dialog.For example, claude code memory principles and memory folder structure, openclaw memory.

Useful reading in addition to pointers in the lecture material:

Block 4: hybrid systems and uncertain knowledge

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

Lecture: issues in formalizing commonsense reasoning: open/closed world, frame problem, uncertainties: 6. April

First, open/closed world, world states, 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 and put them on other blocks or on the table. The arm cannot lift several blocks or a tower of blocks. Then, given a position of blocks at initial situation, can the robot arm create a required new position of blocks? Can we get the steps required? For getting the steps we use the $ans predicate.

One hard issue arising is that how do we know that doing some action like lifting a block does not create side effects like stumbling existing towers, moving other blocks etc? This issue is called the frame problem and it has no easy solutions.

Importantly, the frame problem arises since normal first order logic has

  • the open world assumption: 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.

Prolog and databases operate under the

  • closed world assumption E1 (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 "negation" really means "cannot prove". 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 "true", "false" and "unknown". See also negation as failure in prolog


Please look at and read these materials about the frame problem:

These two readings are optional:

  • frame problem at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.
  • 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.

You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: see this article.

Next, importantly, you should experiment yourself with gkc and both of the following files. Please copy and read the files and understand the encoding. At the end of the files are several queries to experiment with: instructions are also there. The simplest way to experiment is to use https://logictools.org/ . There is already a blocks world example available.

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).

To get a simple visualization of the blocks world, have a look at this tiny video.


Second, uncertainty


Loengu sissejuhatava osa presentatsioon: Reasoning_with_uncertainty.pdf E1.

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.

We will consider two different ways to tackle uncertainty:

  • Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.
  • Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people.

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.

The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer Numeric uncertainty: (E2 up to and including the chapter 3, see also E2 tags inside)

  • Read carefully up to and including the chapter 4 "Different ways to encode confidences in logic" and have a quick look at all the wikipedia links. In particular, Wiki on Bayesian inference and this
  • Skim through the later parts and look only into these subchapters which you found interesting.

Next,

  • Read the paper E2 about confidences. containing intro, algorithms and experiments. Then look at the web page with the confer reasoner and a wealth of examples.
  • Read the paper E2 about exceptions (default logic). containing intro, alorithms and experiments. Then look at the web page with the gk reasoner and a wealth of examples.

Next, have a brief look at a good example system doing some specific kinds of probability reasoning:

Lecture: research in neurosymbolic reasoning: 13 April

lecture slides

The lecture will be given by our PhD student Otto Mättas.

Lecture: semantic parsing with LLMs and with UDP: 20 April

The focus of the lecture is on semantic parsing.

For a quick intro we will use Martin's slides from 2024 semantic parsing E2.

The rest of the lecture will explain stuff in nlpsolver. See the nlpsolver presentation.

Useful background:

About important concepts in parsing:

Some important toolkits and representation schemes:

Some draft parsing papers:


Lecture: we explore some recent papers in neurosymbolic reasoning: 27 April

A reading session: we will read and attempt to understand together some case studies.

Lecture: visual reasoning: 4. May

The lecture will be given by our postdoc researcher Mohit Vaishnav.

Lecture presentation E2

Related preprints:

Lecture: we continue exploring recent papers in neurosymbolic reasoning: 11 May

We look at some of the more interesting papers from each subarea (maybe not all the papers):

Logic focus:

Visual reasoning:

Planning:

Text-to-SQL:

Consultation for the exam: 18 May