{"id":27918750,"url":"https://github.com/blakeziegler/summarize-local-llm","last_synced_at":"2026-04-26T22:31:27.491Z","repository":{"id":290457141,"uuid":"974518596","full_name":"blakeziegler/summarize-local-llm","owner":"blakeziegler","description":"Indiana University Change Lab Custom Summarization Grader","archived":false,"fork":false,"pushed_at":"2025-05-06T01:03:45.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-06T18:50:17.902Z","etag":null,"topics":["cors","fastapi","huggingface","javascript","language-tool-python","llm","pydantic","transformers","uvicorn"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blakeziegler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-04-28T22:50:31.000Z","updated_at":"2025-05-06T01:03:48.000Z","dependencies_parsed_at":"2025-04-28T23:45:06.290Z","dependency_job_id":"5076cced-bd2e-4cd5-9a53-172c2df817de","html_url":"https://github.com/blakeziegler/summarize-local-llm","commit_stats":null,"previous_names":["blakeziegler/summarize-local-llm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/blakeziegler/summarize-local-llm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blakeziegler%2Fsummarize-local-llm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blakeziegler%2Fsummarize-local-llm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blakeziegler%2Fsummarize-local-llm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blakeziegler%2Fsummarize-local-llm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blakeziegler","download_url":"https://codeload.github.com/blakeziegler/summarize-local-llm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blakeziegler%2Fsummarize-local-llm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32315711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T21:09:39.134Z","status":"ssl_error","status_checked_at":"2026-04-26T21:09:21.240Z","response_time":129,"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":["cors","fastapi","huggingface","javascript","language-tool-python","llm","pydantic","transformers","uvicorn"],"created_at":"2025-05-06T18:25:14.905Z","updated_at":"2026-04-26T22:31:27.486Z","avatar_url":"https://github.com/blakeziegler.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Indiana University Change Lab - Custom Summarization Grader\n\n### Introduction\nThis repository contains a full-stack custom summarization grader engineered for the Indiana University Change Lab built on the JsPsych framework.\n\n### Summarization Components\n**1. Reference Summary Generation and Comparison** \\\nA \"gold standard\" summary is generated using Facebook's BART-CNN model:\n\n```\nref_out = summarizer(\n    passage,\n    max_length=256,\n    min_length=100,\n    num_beams=4,\n    length_penalty=1.2,\n    early_stopping=True,\n    do_sample=False,\n)\nreference = ref_out[0][\"summary_text\"].strip()\n```\n\nThe reference and student summary are embedded with all-mpnet-base-v2:\n\n```\nemb_ref = embedder.encode(reference, convert_to_tensor=True)\nemb_pred = embedder.encode(prediction, convert_to_tensor=True)\nref_cos  = util.cos_sim(emb_ref, emb_pred).item()\nreference_similarity = ((ref_cos + 1) / 2) * 100\n```\n\n**2. Context Similarity** \\\nContext similarity is used to ensure the student retained core content by comparing it to the original passage:\n\n```\nemb_ctx = embedder.encode(passage, convert_to_tensor=True)\nctx_cos = util.cos_sim(emb_ctx, emb_pred).item()\ncontext_similarity = ctx_cos * 50 + 50\n```\n\n**3. Length Penalty** \\\nThe length Penalty is added to discourage responses that are too short or too long based on length ratio between the summary given and original text:\n\n```\n    ref_len = len(reference.split())\n    pred_len = len(prediction.split())\n    if pred_len \u003c 20:\n        length_penalty = 15\n    else:\n        ratio = pred_len / ref_len if ref_len \u003e 0 else 0\n        if ratio \u003c 0.15:\n            length_penalty = 15\n        elif ratio \u003c 0.25:\n            length_penalty = 10\n        elif ratio \u003c 0.35:\n            length_penalty = 5\n        elif ratio \u003e 0.65:\n            length_penalty = 5\n        elif ratio \u003e 0.75:\n            length_penalty = 10\n        else:\n            length_penalty = 0\n```\n\n**4. Grammar Penalty** \\\nWe use the Python language tools to detect grammar violations. We compute errors per 100 words and apply a 1 point error for each, with a max deduction of 20 points:\n\n```\n    matches = grammar_tool.check(prediction)\n    errors_per_100 = len(matches) / (pred_len / 100) if pred_len \u003e 0 else len(matches)\n    grammar_penalty = min(int(errors_per_100 * 1), 20)\n```\n\n**5. Final Calculation** \\\nThe final score is calculated by taking the average of the two similarity scores, and deducting the length and grammar penalties:\n```\n    raw_score   = 0.5 * reference_similarity + 0.5 * context_similarity\n    interim     = round(raw_score)\n    final_score = max(0, interim - length_penalty - grammar_penalty)\n```\n\n### To-Do\n- Fix random Prompt generation from Context -\u003e Prompt\n- Log the scoring breakdown on the backend and export to csv\n- Create client-facing error messages based on score breakdown\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblakeziegler%2Fsummarize-local-llm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblakeziegler%2Fsummarize-local-llm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblakeziegler%2Fsummarize-local-llm/lists"}