Home / Companies / Lightning AI / Blog / July 2023

July 2023 Summaries

6 posts from Lightning AI

Filter
Month: Year:
Post Summaries Back to Blog
Open-source large language models have made chatbot development more accessible for applications such as customer service, healthcare, and document-based question answering. The tutorial demonstrates building a basic chatbot with Lit-GPT, LangChain, and the instruction-tuned LongChat model, using a prompt template that directs the model to provide helpful and polite responses and loading the model with 4-bit quantization to reduce GPU memory requirements. Because LLM calls are stateless, the example addresses conversational continuity by including prior exchanges in each new prompt, with LangChain’s PromptTemplate, ConversationChain, and ConversationBufferMemory managing and updating chat history. The approach can be extended beyond simple conversations by retrieving relevant documents or database information and supplying that material as context for answers. The post notes that its Lit-GPT code may be outdated and recommends consulting the official repository for current examples.
Jul 22, 2023 1,375 words in the original blog post.
The NeurIPS 2023 LLM Efficiency Challenge invites participants to fine-tune Lit-GPT on a single GPU within one day, with an opportunity to win a speaker slot at the conference. Resources include a registration link, an official Lit-GPT starter kit, submission guidelines, and tutorials covering custom-dataset fine-tuning and efficient Falcon LLM fine-tuning using LoRA and adapters.
Jul 15, 2023 65 words in the original blog post.
Lightning is a unified framework from Lightning AI that includes PyTorch Lightning, Lightning Fabric, Lightning Apps, and TorchMetrics, designed to complement rather than replace PyTorch by simplifying model training, evaluation, and scaling. PyTorch Lightning provides a structured, high-level approach through LightningModule and Trainer, automating training loops, distributed multi-GPU or multi-node execution, logging, callbacks, checkpoints, and evaluation conventions, while Lightning Fabric offers a lighter-weight alternative that manages hardware and distributed-training setup but leaves engineers in control of custom training loops. Examples based on MLP and ElasticNet-style models illustrate how standard PyTorch nn.Module models can be wrapped in LightningModule or trained with Fabric, reducing boilerplate while preserving flexibility. The Lightning Quant project demonstrates both approaches in an algorithmic-trading context, including custom Trainer and Fabric implementations, datasets and data modules, regularization and metrics, and Typer-based command-line commands for launching training sessions.
Jul 13, 2023 3,043 words in the original blog post.
TorchMetrics evolved from an early PyTorch Lightning metric-interface proposal in April 2020, created to provide unified, distributed-aware metric computation and initially relying heavily on scikit-learn for correctness and rapid coverage. Early development introduced separate NumPy and tensor metric handling, distributed aggregation, native PyTorch implementations for common classification metrics, and contributions such as MetricCollection and substantial test-speed improvements. A major API redesign in PyTorch Lightning 0.10.0 established the durable update-compute model, allowing metrics to maintain memory-efficient internal states, process batched datasets, and synchronize correctly across distributed GPUs. The metrics code became the standalone torchmetrics package in February 2021 while retaining its commit history, and it expanded from roughly 20 regression and classification metrics to more than 100 covering areas including audio, detection, image, retrieval, and text. Its contributors published a JOSS paper in February 2022, and version 1.0.0, released July 5, 2023, added plotting and visualization capabilities while marking a milestone in the project’s open-source development.
Jul 10, 2023 1,018 words in the original blog post.
TorchMetrics v1.0 marks the library’s first major stable release, introducing built-in Matplotlib-based plotting through a unified `.plot` method that can visualize individual metric values, training histories, multi-output metrics, and specialized outputs such as confusion matrices and ROC curves. The release surpasses 100 metrics across 12 categories, adding 15 capabilities including audio, classification fairness, regression, image, and object-detection metrics, as well as wrappers such as Running for calculating running averages. Other changes include official Python 3.11 support, removal of Python 3.7 support, deprecation of root-level imports for many subpackage metrics, and a shift to pycocotools as the MeanAveragePrecision backend for improved correctness and performance. The project plans to continue expanding its metric coverage and reports adoption in more than 12,000 projects alongside over 1,500 GitHub stars.
Jul 04, 2023 1,090 words in the original blog post.
Peak GPU memory is a major constraint in training large deep-learning models, and the article demonstrates how cumulative PyTorch techniques can reduce memory use by roughly 20 times while maintaining model accuracy. Using a Vision Transformer finetuning example and the Lightning Fabric library, it examines mixed and bfloat16 precision, smaller batch sizes, gradient accumulation, leaner optimizers, direct model initialization on the target device, Fully Sharded Data Parallelism across GPUs, activation checkpointing, and CPU parameter offloading. Mixed precision substantially lowers memory while improving runtime, whereas microbatching, checkpointing, and offloading trade additional computation time for further savings. The methods are presented as broadly applicable to convolutional networks, transformers, and language models, with the combined optimizations enabling BigBird and DistilBERT classification training on relatively limited GPU memory, including BigBird at about 4 GB of peak GPU RAM.
Jul 02, 2023 3,220 words in the original blog post.