LLM-Powered Text Summarization for .NET Applications
π― Purpose of the Sample
This Text Summarization Demo showcases how to use the LM-Kit.NET SDK to condense lengthy passages of text into concise summaries, optionally including a generated title. Text summarization helps streamline workflows by quickly surfacing the core message of voluminous contentβreducing the time and effort required to digest large documents, emails, articles, or reports.
By utilizing the Summarizer
class, developers gain access to a high-level API that encapsulates all the complexity of prompt design, title generation, and summary extraction. Moreover, the demo supports various pre-trained models and leverages LM-Kit's on-device technology for efficient, secure processing.
π₯ Industry Target Audience
The Text Summarization sample benefits developers and teams across numerous fields where efficiently distilling information is critical:
- π° News & Media: Summarize long-form journalism, press releases, and news feeds for quick editorial decisions or rapid content curation.
- π¦ Finance & Research: Create concise synopses of financial reports, research documents, and market analyses to speed up insight extraction.
- π« Education & E-Learning: Automatically condense study materials, lecture transcripts, or course content, aiding quick review or study guides.
- πΌ Business & Management: Summarize lengthy business proposals, legal documents, meeting transcripts, or policy memos to accelerate decision-making.
- π Knowledge Management: Provide short, readable abstracts for knowledge base articles or archived materials, improving discoverability and comprehension.
- 𧩠Product & UX: Integrate automated summary previews in reading applications, dashboards, or search results to enhance user engagement and experience.
π Problem Solved
Manually summarizing text can be labor-intensive and prone to oversight. The Text Summarization Demo automates this process, producing concise and coherent summaries in seconds. By highlighting essential points and discarding extraneous details, this solution helps users quickly comprehend the main ideas, guiding faster decisions and more informed research. Whether used for content filtering, improved productivity, or integrated into user-facing products, automated summarization cuts through information overload.
π» Sample Application Description
The Text Summarization Demo is a console application that prompts users to provide an input text file. It then invokes the Summarizer
class to summarize the text and optionally generate a title. Developers can easily adjust parameters like MaxContentWords
to control the summary length, and GenerateTitle
to include a headline.
This streamlined interface provides a powerful starting point for integrating summarization into various workflows, from quick content previews and accelerated research to improving the utility of search and recommendation systems.
β¨ Key Features
- π§ Model Flexibility: Pick from a range of pre-trained models or specify a custom model URI.
- π Title & Content: Generate both a brief title and a summary of the main text, improving content navigation.
- π Adjustable Length: Control the maximum word count to produce shorter abstracts or more detailed condensations.
- π Guidance Support: Nudge the model towards certain tones or themes by providing optional guidance text.
- β‘ Fast, On-Device: No external services required, ensuring low latency and enhanced privacy.
π§ Supported Models
Similar to other LM-Kit samples, this demo supports a variety of pre-trained models, including:
- Mistral Nemo 2407 12.2B
- Meta Llama 3.1 8B
- Google Gemma2 9B Medium
- Microsoft Phi-3.5 3.8B Mini
- Alibaba Qwen-2.5 7.6B
- Alibaba Qwen-2.5 0.5B
- Meta Llama 3.2 1B
- Additional smaller models or custom model URIs as desired
π οΈ Getting Started
π Prerequisites
- .NET Framework 4.6.2 or .NET 6.0
π₯ Download the Project
βΆοΈ Running the Application
π Clone the repository:
git clone https://github.com/LM-Kit/lm-kit-net-samples.git
π Navigate to the project directory:
cd lm-kit-net-samples/console_net6/text_summarizer
or
cd lm-kit-net-samples/console_framework_4.62/text_summarizer
π¨ Build and run the application:
dotnet build dotnet run
π‘ Example Usage
Set the License Key (if available):
LMKit.Licensing.LicenseManager.SetLicenseKey(""); // Optionally set a license key.
Select the Model: When prompted, choose one of the listed models or enter a custom model URI:
Select the model you want to use: 0 - Mistral Nemo 2407 12.2B (β 7.7 GB VRAM required) 1 - Meta Llama 3.1 8B (β 6 GB VRAM required) ... Or enter a custom model URI: >
Provide the Input Text File: After model selection, enter the path to a text file containing the input text to summarize:
Please enter the path to the text file containing your input: > path/to/your/textfile.txt
View the Generated Summary: Once processing is complete, the application displays a generated title (if enabled) and a concise summary:
Summarizing content with N words to M max words... Title: Your Generated Title Here Summary: Your concise summary content here. Summarization completed in X.XX seconds | Summary word count: Y | Confidence: Z.ZZ
Developers can integrate this summarization workflow into their larger .NET applications, saving time and improving the user experience. By customizing parameters, guidance, and model selection, this demo provides a flexible foundation for building robust summarization capabilities into any text-heavy workflow.