{"id":22654260,"url":"https://github.com/do-me/long-context-prompting-talk","last_synced_at":"2026-02-12T17:01:59.127Z","repository":{"id":266310017,"uuid":"897992158","full_name":"do-me/long-context-prompting-talk","owner":"do-me","description":"Supporting repo for my talk on \"Long-Context Prompting: Challenges, Solutions, Examples\" for GPT@JRC","archived":false,"fork":false,"pushed_at":"2024-12-03T16:44:18.000Z","size":269,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-19T16:36:28.177Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/do-me.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-03T15:43:28.000Z","updated_at":"2024-12-09T07:37:48.000Z","dependencies_parsed_at":"2024-12-03T16:51:32.235Z","dependency_job_id":null,"html_url":"https://github.com/do-me/long-context-prompting-talk","commit_stats":null,"previous_names":["do-me/long-context-prompting-talk"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/do-me/long-context-prompting-talk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/do-me%2Flong-context-prompting-talk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/do-me%2Flong-context-prompting-talk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/do-me%2Flong-context-prompting-talk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/do-me%2Flong-context-prompting-talk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/do-me","download_url":"https://codeload.github.com/do-me/long-context-prompting-talk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/do-me%2Flong-context-prompting-talk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29373837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T08:51:36.827Z","status":"ssl_error","status_checked_at":"2026-02-12T08:51:26.849Z","response_time":55,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-09T09:36:10.876Z","updated_at":"2026-02-12T17:01:59.114Z","avatar_url":"https://github.com/do-me.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LLM Long Context Prompting\nThis is the supporting repo for my talk on 4 December 2024 for GPT@JRC. \n\nIt includes a practical example for efficient use of long-context models (\u003e64,000 tokens like \u003eLlama 3.1, Qwen 2.5, or commercial models like Gemini Pro 1.5 with 2M tokens).\n\n## Conclusion\n\nThe whole point of the presentation is that:\n- you should make efficient use of the model's context length and provide as much information right in the prompt as you can\n- you should be aware of a model's output quality which might dramatically decrease [as detailed here](https://github.com/NVIDIA/RULER) like when you use more than 64k tokens in Llama 3.1. Newer models \u0026 commercial models do not seem to have this problem anymore [as described in Google's February 2024 blog](https://blog.google/technology/ai/google-gemini-next-generation-model-february-2024/#performance)\n- if you can fit all information in the prompt, do so and [do not use RAG](https://arxiv.org/abs/2407.16833) for improved quality\n- if the prompt exceeds the model's context, summarize the data with LLMs and use [LLMLingua2](https://huggingface.co/spaces/microsoft/llmlingua-2) to compress it further, but check the results! Be careful when you enter a database with highly varying text lengths - long text entries might create a bias with respect to shorter ones\n- if it's still too much information, you can use a hybrid approach [as proposed by Google](https://arxiv.org/abs/2407.16833)\n\n## Example Use Case\n\nThe European Commission wants to reduce the [reporting burden](https://commission.europa.eu/system/files/2023-10/Factsheet_CWP_Burdens_10.pdf) by 25%. Earth Observation can contribute especially to this bullet: \n\n\u003e To revise the Regulation on European statistics, aimed at reducing the number of surveys and\nincreasing the use of automated and simplified processes, which will bring cost savings – including for\nSMEs – of an estimated €450 million.\n\nThe idea here is to create a first automatic link between [European legislation](https://eur-lex.europa.eu/homepage.html?locale=en) and e.g. [Copernicus products](https://www.copernicus.eu/en/accessing-data-where-and-how/copernicus-services-catalogue).\n\nIf you are part of an EU institution, please feel free to reach out.\n\n## Example output \n\n### 1 Reducing reporting burden in the water framework directive with Copernicus Land products\nRun with Llama 3.1 70B Instruct with [this prompt](https://github.com/do-me/long-context-prompting-talk/blob/main/complete_prompt.txt), consisting of:\n\n1. a main prompt\n\n\u003e I will give you a piece of legislation and a list of Copernicus Land products.\nExtract all reporting obligations in the paragraphs and create a table linking the most suitable Land products to the paragraphs.\nThe output table should contain following columns:\nReporting obligation summary, reporting obligation citation, Land product title, land product url.\n\n2. [the water framework directive from EUR-LEX](https://eur-lex.europa.eu/legal-content/EN/TXT/HTML/?uri=CELEX:32000L0060)\n3. [Copernicus Land products](https://github.com/do-me/long-context-prompting-talk/blob/main/copernicus_land_products.txt)\n\n| Reporting Obligation Summary | Reporting Obligation Citation | Land Product Title | Land Product URL |\n| --- | --- | --- | --- |\n| Analyze characteristics of river basin district, review impact of human activity, and conduct economic analysis of water use | Article 5 | CLC+Backbone 2018 (raster 10 m), Europe, 3-yearly | https://land.copernicus.eu/en/products/clc-backbone/clc-backbone-2018 |\n| Monitor water status in river basin district | Article 8 | Imperviousness Density 2018 (raster 10 m and 100 m), Europe, 3-yearly | https://land.copernicus.eu/en/products/high-resolution-layer-imperviousness/imperviousness-density-2018 |\n| Monitor surface water status | Article 8 | High Resolution Image Mosaic 2018 True Colour (raster 10 m), Europe, 3-yearly | https://land.copernicus.eu/en/products/european-image-mosaic/high-resolution-image-mosaic-2018-true-colour-10m |\n| Monitor groundwater status | Article 8 | European Ground Motion Service: Basic 2019-2023 (vector), Europe, yearly | https://land.copernicus.eu/en/products/european-ground-motion-service/egms-basic |\n| Identify waters used for drinking water abstraction | Article 7 | Water Bodies 2020-present (raster 100 m), global, monthly – version 1 | https://land.copernicus.eu/en/products/water-bodies/water-bodies-global-v1-0-100m |\n| Develop river basin management plan | Article 13 | CORINE Land Cover 2018 (vector/raster 100 m), Europe, 6-yearly | https://land.copernicus.eu/en/products/corine-land-cover/clc2018 |\n| Consult public on river basin management plan | Article 14 | Urban Atlas Land Cover/Land Use 2018 (vector), Europe, 6-yearly | https://land.copernicus.eu/en/products/urban-atlas/urban-atlas-2018 |\n| Report to Commission on river basin management plan | Article 15 | Normalised Difference Vegetation Index 2014-2020 (raster 300 m), global, 10-daily – version 1 | https://land.copernicus.eu/en/products/vegetation/normalized-difference-vegetation-index-300m-v1.0 |\n| Establish environmental quality standards for priority substances | Article 16 | Water Bodies 2020-present (raster 100 m), global, monthly – version 1 | https://land.copernicus.eu/en/products/water-bodies/water-bodies-global-v1-0-100m |\n| Report to Commission on implementation of Directive | Article 18 | High Resolution Image Mosaic 2018 True Colour (raster 10 m), Europe, 3-yearly | https://land.copernicus.eu/en/products/european-image-mosaic/high-resolution-image-mosaic-2018-true-colour-10m |\n\n### 2 Attribute SDG indicators to the water framework directive\n\n\u003e I will give you a piece of legislation and a list of SDG indicators. Create a table with the top 10 most suitable SDG indicators and the grouped articles. Every article can be referenced multiple times.\nThe output table should contain following columns:\nSDG indicator number, SDG indicator, Article numbers, reasoning\n\nThen add the legislation text \u0026 the SDG indicators. Here is the [full prompt](https://github.com/do-me/long-context-prompting-talk/blob/main/sdg_attribution_prompt.txt).\n\nRun with Llama 3.1 70B Instruct:\n\n| SDG Indicator Number | SDG Indicator | Article Numbers | Reasoning |\n| --- | --- | --- | --- |\n| 6.3.1 | Proportion of domestic and industrial wastewater flows safely treated | Article 10, 11.3 | The legislation emphasizes the importance of treating wastewater to prevent pollution and protect the environment. |\n| 6.4.1 | Change in water-use efficiency over time | Article 9, 11.3 | The legislation encourages water-use efficiency and the recovery of costs for water services. |\n| 6.5.1 | Degree of integrated water resources management | Article 3, 4, 5 | The legislation promotes integrated water resources management and the coordination of measures at the river basin level. |\n| 6.5.2 | Proportion of transboundary basin area with an operational arrangement for water cooperation | Article 3, 5 | The legislation emphasizes the importance of cooperation and coordination between Member States in transboundary river basins. |\n| 6.6.1 | Change in the extent of water-related ecosystems over time | Article 4, 7 | The legislation aims to protect and enhance the aquatic environment and promote sustainable water use. |\n| 6.a.1 | Amount of water- and sanitation-related official development assistance that is part of a government-coordinated spending plan | Article 9, 11.3 | The legislation encourages the provision of financial resources to support water and sanitation infrastructure. |\n| 6.b.1 | Proportion of local administrative units with established and operational policies and procedures for participation of local communities in water and sanitation management | Article 14, 15 | The legislation promotes public participation and consultation in the development of river basin management plans. |\n| 11.5.1 | Number of deaths, missing persons and directly affected persons attributed to disasters per 100,000 population | Article 4, 11.3 | The legislation aims to prevent and mitigate the effects of floods and droughts. |\n| 12.4.1 | Number of parties to international multilateral environmental agreements on hazardous waste, and other chemicals that meet their commitments and obligations in transmitting information as required by each relevant agreement | Article 16, 17 | The legislation promotes the adoption of measures to prevent and control pollution of water. |\n| 15.1.1 | Forest area as a proportion of total land area | Article 4, 7 | The legislation aims to protect and enhance the aquatic environment and promote sustainable water use, which is closely related to forest conservation. |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdo-me%2Flong-context-prompting-talk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdo-me%2Flong-context-prompting-talk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdo-me%2Flong-context-prompting-talk/lists"}