Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| # Initialize the slide groups in session state on first run. | |
| if "slide_groups" not in st.session_state: | |
| st.session_state.slide_groups = [ | |
| { | |
| "group": "Slide 1: Introduction", | |
| "content": r""" | |
| **Title:** AI Toolbox: 20 Papers in 5 Minutes | |
| **Goal:** Show how these topics (Torch, Ollama, Deepseek, SFT, knowledge distillation, crowdsourcing, etc.) tie together into an end-to-end AI pipeline. | |
| **Media:** Quick intro audio & a short video clip highlighting AI breakthroughs. | |
| """ | |
| }, | |
| { | |
| "group": "Slides 2–3: Torch (PyTorch Foundations)", | |
| "content": r""" | |
| **Paper 1** | |
| *Reference:* Paszke, A. et al. “PyTorch: An Imperative Style, High-Performance Deep Learning Library.” arXiv:1912.01703 (2019) | |
| *Key Points:* | |
| - Dynamic computation graphs for rapid prototyping. | |
| - Strong GPU acceleration and broad community support. | |
| *Presentation Element:* Brief code snippet in Python + a Mermaid flowchart showing how forward/backprop flows in PyTorch. | |
| **Paper 2** | |
| *Reference:* Paszke, A. et al. “Automatic Differentiation in PyTorch.” arXiv:1707.?? (Hypothetical reference) | |
| *Key Points:* | |
| - Core mechanism behind autograd. | |
| - How tensor operations are tracked and reversed for gradients. | |
| *Presentation Element:* Minimal slides highlighting computational graph merges with HPC concepts. | |
| """ | |
| }, | |
| { | |
| "group": "Slides 4–5: Ollama & LLaMA-Based Models", | |
| "content": r""" | |
| **Paper 3** | |
| *Reference:* Touvron, H. et al. “LLaMA: Open and Efficient Foundation Language Models.” arXiv:2302.13971 (2023) | |
| *Key Points:* | |
| - Architecture, training efficiency, and open-source benefits. | |
| - Relevance to Ollama (lightweight local LLaMA inference). | |
| *Presentation Element:* Short video demo of an Ollama prompt or model reply. | |
| **Paper 4** | |
| *Reference:* Zhang, M. et al. “Exploring LLaMA Derivatives for Local Inference.” arXiv:2303.???? (Hypothetical) | |
| *Key Points:* | |
| - Techniques for running large models on consumer-grade hardware. | |
| - Model quantization, CPU/GPU scheduling. | |
| *Presentation Element:* Mermaid sequence diagram comparing server-based vs. local inference pipelines. | |
| """ | |
| }, | |
| { | |
| "group": "Slides 6–7: Deepseek MoE + Chain of Thought (CoT)", | |
| "content": r""" | |
| **Paper 5** | |
| *Reference:* Fedus, W., Zoph, B., Shazeer, N. “Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity.” arXiv:2101.03961 (2021) | |
| *Key Points:* | |
| - Mixture-of-Experts (MoE) approach to scale large models. | |
| - Efficiency gains via sparse routing. | |
| *Presentation Element:* Visual MoE block diagram with color-coded experts. | |
| **Paper 6** | |
| *Reference:* Wei, J. et al. “Chain-of-Thought Prompting Elicits Reasoning in Large Language Models.” arXiv:2201.11903 (2022) | |
| *Key Points:* | |
| - Step-by-step reasoning prompts improve logical consistency. | |
| - Potential synergy with MoE for specialized “reasoning experts.” | |
| *Presentation Element:* Mermaid mind map illustrating short CoT vs. detailed CoT. | |
| """ | |
| }, | |
| { | |
| "group": "Slides 8–9: Hugging Face SFT Trainer", | |
| "content": r""" | |
| **Paper 7** | |
| *Reference:* Wolf, T. et al. “Transformers: State-of-the-Art Natural Language Processing.” arXiv:1910.03771 (2020) | |
| *Key Points:* | |
| - Core library behind Hugging Face’s ecosystem. | |
| - Transformer architecture fundamentals. | |
| *Presentation Element:* Show how SFTTrainer (hypothetical name) builds on Trainer for supervised finetuning. | |
| **Paper 8** | |
| *Reference:* Houlsby, N. et al. “Parameter-Efficient Transfer Learning for NLP.” arXiv:1902.00751 (2019) | |
| *Key Points:* | |
| - Techniques like adapters, LoRA, or selective layer freezing. | |
| - Impact on training efficiency and model size. | |
| *Presentation Element:* A side-by-side bar chart showing reduction in GPU hours with parameter-efficient methods. | |
| """ | |
| }, | |
| { | |
| "group": "Slides 10–11: Knowledge Distillation & Mermaid Graphs", | |
| "content": r""" | |
| **Paper 9** | |
| *Reference:* Hinton, G., Vinyals, O., Dean, J. “Distilling the Knowledge in a Neural Network.” arXiv:1503.02531 (2015) | |
| *Key Points:* | |
| - Transfer knowledge from large “teacher” models to small “student” models. | |
| - Temperature scaling and teacher-student training. | |
| *Presentation Element:* Mermaid flowchart detailing teacher–student relationships. | |
| **Paper 10** | |
| *Reference:* Chen, X. et al. “Graph-Based Knowledge Distillation for Neural Networks.” arXiv:2105.???? (Hypothetical) | |
| *Key Points:* | |
| - Represent model layers and hidden states as nodes & edges. | |
| - Synergy with SFT and domain adaptation. | |
| *Presentation Element:* Mermaid graph diagram linking teacher network nodes to student network nodes. | |
| """ | |
| }, | |
| { | |
| "group": "Slides 12–13: Crowdsourcing & Agents for Evaluation", | |
| "content": r""" | |
| **Paper 11** | |
| *Reference:* Callison-Burch, C. “Fast, Cheap, and Creative: Evaluating Translation Quality Using Amazon’s Mechanical Turk.” arXiv:0907.5225 (2009) | |
| *Key Points:* | |
| - Crowdsourcing pipeline for large-scale text evaluation. | |
| - Reliability strategies: gold standards, inter-annotator agreement. | |
| *Presentation Element:* Timeline comparing tasks for crowdworkers vs. automated agents. | |
| **Paper 12** | |
| *Reference:* Nie, Y. et al. “Adversarial NLI: A New Benchmark for Natural Language Understanding.” arXiv:1910.14599 (2019) | |
| *Key Points:* | |
| - Human-and-model-in-the-loop adversarial examples. | |
| - Incremental data curation to improve robustness. | |
| *Presentation Element:* Short audio explanation of adversarial example refinement. | |
| """ | |
| }, | |
| { | |
| "group": "Slides 14–15: Python + Gradio/Streamlit", | |
| "content": r""" | |
| **Paper 13** | |
| *Reference:* Abid, A. et al. “Gradio: A User Interface for Interactive Machine Learning.” arXiv:2101.???? (Hypothetical) | |
| *Key Points:* | |
| - Build quick demos and capture user feedback. | |
| - Invaluable for crowdsourced data collection and real-time model updates. | |
| *Presentation Element:* 10-second video demo of a Gradio UI (e.g. a chatbot or image classifier). | |
| **Paper 14** | |
| *Reference:* [Streamlit Team], “Streamlit: Democratizing Data App Creation.” arXiv:2004.???? (Hypothetical) | |
| *Key Points:* | |
| - Turning Python scripts into web apps effortlessly. | |
| - Useful for HPC dashboards and debugging distributed training. | |
| *Presentation Element:* Animated slides showing how to add interactive widgets with minimal code. | |
| """ | |
| }, | |
| { | |
| "group": "Slides 16–17: HPC for Python-Based AI", | |
| "content": r""" | |
| **Paper 15** | |
| *Reference:* Shoeybi, M. et al. “Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism.” arXiv:1909.08053 (2019) | |
| *Key Points:* | |
| - Scaling large models via model parallelism on HPC clusters. | |
| - Integration with NVIDIA libraries (e.g. NCCL). | |
| *Presentation Element:* Mermaid architecture diagram illustrating parallel pipelines. | |
| **Paper 16** | |
| *Reference:* Huang, Y. et al. “GPipe: Efficient Training of Giant Neural Networks using Pipeline Parallelism.” arXiv:1811.06965 (2019) | |
| *Key Points:* | |
| - Overlap of communication and computation for HPC efficiency. | |
| - Synergy with MoE or large LLaMA models. | |
| *Presentation Element:* Throughput vs. latency charts and an HPC cluster image. | |
| """ | |
| }, | |
| { | |
| "group": "Slides 18–19: Semantic & Episodic Memory + RLHF", | |
| "content": r""" | |
| **Paper 17** | |
| *Reference:* Ouyang, X. et al. “Integrating Episodic and Semantic Memory for Task-Oriented Dialogue.” arXiv:2105.???? (Hypothetical) | |
| *Key Points:* | |
| - Differentiate short-term episodic from long-term semantic context. | |
| - Improves consistency and factual correctness in dialogue. | |
| *Presentation Element:* Mermaid diagram contrasting ephemeral vs. persistent memory flows. | |
| **Paper 18** | |
| *Reference:* Ouyang, X. et al. “Training Language Models to Follow Instructions with Human Feedback.” arXiv:2203.02155 (2022) | |
| *Key Points:* | |
| - Reinforcement Learning from Human Feedback (RLHF). | |
| - Align model outputs with user preferences and ethical guidelines. | |
| *Presentation Element:* RLHF pseudo-code snippet and a timeline of preference collection. | |
| """ | |
| }, | |
| { | |
| "group": "Slides 20–21: Transfer Learning & “Learning for Good”", | |
| "content": r""" | |
| **Paper 19** | |
| *Reference:* Ruder, S. “A Survey on Transfer Learning for NLP.” arXiv:1910.?? (2019) | |
| *Key Points:* | |
| - Overview of transfer learning strategies (fine-tuning, adapters, multitask learning). | |
| - Quickly customize large pre-trained models. | |
| *Presentation Element:* Graph of performance gains vs. training time. | |
| **Paper 20** | |
| *Reference:* Zhang, Y., Yang, Q. “A Survey on Multi-Task Learning.” arXiv:1707.08114 (2017) | |
| *Key Points:* | |
| - Train one model on multiple tasks to share representations. | |
| - Synergy with “Learning for Good” scenarios (e.g., medical, climate). | |
| *Presentation Element:* Mermaid multi-task diagram showing convergence in shared layers. | |
| """ | |
| }, | |
| { | |
| "group": "Slide 22: Closing & Next Steps", | |
| "content": r""" | |
| **Key Takeaways:** | |
| - **Integration:** Every paper contributes to an end-to-end AI pipeline—from HPC scaling to crowdsourced evaluation. | |
| - **Modular Approach:** Combining PyTorch, Hugging Face SFT, and knowledge distillation leads to efficient model development. | |
| - **Interactive Demonstrations:** Leveraging Gradio/Streamlit and RLHF creates user-friendly, human-centric AI experiences. | |
| - **Future Work:** Explore deeper synergies among MoE, HPC, and memory-based architectures. | |
| **Media:** | |
| - Concluding audio clip. | |
| - (Optionally) a final Mermaid diagram linking all stages: data ingestion → HPC training → crowdsourcing → RLHF → model deployment. | |
| """ | |
| } | |
| ] | |
| st.session_state.current_index = 0 # Initialize the current slide index | |
| # Set up the page configuration | |
| st.set_page_config(page_title="AI Presentation Outline", layout="wide") | |
| st.title("AI Toolbox Presentation Outline") | |
| # Sidebar: Navigation and slide group addition | |
| st.sidebar.header("Navigation") | |
| # --- Option to add a new slide group --- | |
| with st.sidebar.expander("Add New Slide Group"): | |
| with st.form("new_slide_form"): | |
| new_group = st.text_input("Slide Group Title") | |
| new_content = st.text_area("Slide Group Content (Markdown)", height=200) | |
| submitted = st.form_submit_button("Add Slide Group") | |
| if submitted: | |
| if new_group.strip() and new_content.strip(): | |
| st.session_state.slide_groups.append({ | |
| "group": new_group.strip(), | |
| "content": new_content.strip() | |
| }) | |
| st.success(f"Added slide group: {new_group}") | |
| else: | |
| st.error("Please provide both a title and content.") | |
| # --- Slide group selector --- | |
| slide_titles = [slide["group"] for slide in st.session_state.slide_groups] | |
| # Use a selectbox whose index is synced with session_state.current_index | |
| selected_index = st.sidebar.selectbox( | |
| "Select Slide Group", | |
| range(len(slide_titles)), | |
| index=st.session_state.current_index, | |
| format_func=lambda i: slide_titles[i] | |
| ) | |
| st.session_state.current_index = selected_index | |
| # --- Navigation buttons --- | |
| cols = st.sidebar.columns(2) | |
| if cols[0].button("⟨ Previous"): | |
| st.session_state.current_index = max(st.session_state.current_index - 1, 0) | |
| if cols[1].button("Next ⟩"): | |
| st.session_state.current_index = min(st.session_state.current_index + 1, len(slide_titles) - 1) | |
| # Main: Display the selected slide group's details | |
| current_slide = st.session_state.slide_groups[st.session_state.current_index] | |
| st.header(current_slide["group"]) | |
| st.markdown(current_slide["content"], unsafe_allow_html=True) | |