LogoLogo
Continuum WebsiteContinuum ApplicationsContinuum KnowledgeAxolotl Platform
Continuum Knowledge
Continuum Knowledge
  • Continuum
  • Data
    • Datasets
      • Pre Training Data
      • Types of Fine Tuning
      • Self Instruct Paper
      • Self-Alignment with Instruction Backtranslation
      • Systematic Evaluation of Instruction-Tuned Large Language Models on Open Datasets
      • Instruction Tuning
      • Instruction Fine Tuning - Alpagasus
      • Less is More For Alignment
      • Enhanced Supervised Fine Tuning
      • Visualising Data using t-SNE
      • UMAP: Uniform Manifold Approximation and Projection for Dimension Reduction
      • Training and Evaluation Datasets
      • What is perplexity?
  • MODELS
    • Foundation Models
      • The leaderboard
      • Foundation Models
      • LLama 2 - Analysis
      • Analysis of Llama 3
      • Llama 3.1 series
      • Google Gemini 1.5
      • Platypus: Quick, Cheap, and Powerful Refinement of LLMs
      • Mixtral of Experts
      • Mixture-of-Agents (MoA)
      • Phi 1.5
        • Refining the Art of AI Training: A Deep Dive into Phi 1.5's Innovative Approach
      • Phi 2.0
      • Phi-3 Technical Report
  • Training
    • The Fine Tuning Process
      • Why fine tune?
        • Does Fine-Tuning LLMs on New Knowledge Encourage Hallucinations?
        • Explanations in Fine Tuning
      • Tokenization
        • Tokenization Is More Than Compression
        • Tokenization - SentencePiece
        • Tokenization explore
        • Tokenizer Choice For LLM Training: Negligible or Crucial?
        • Getting the most out of your tokenizer for pre-training and domain adaptation
        • TokenMonster
      • Parameter Efficient Fine Tuning
        • P-Tuning
          • The Power of Scale for Parameter-Efficient Prompt Tuning
        • Prefix-Tuning: Optimizing Continuous Prompts for Generation
        • Harnessing the Power of PEFT: A Smarter Approach to Fine-tuning Pre-trained Models
        • What is Low-Rank Adaptation (LoRA) - explained by the inventor
        • Low Rank Adaptation (Lora)
        • Practical Tips for Fine-tuning LMs Using LoRA (Low-Rank Adaptation)
        • QLORA: Efficient Finetuning of Quantized LLMs
        • Bits and Bytes
        • The Magic behind Qlora
        • Practical Guide to LoRA: Tips and Tricks for Effective Model Adaptation
        • The quantization constant
        • QLORA: Efficient Finetuning of Quantized Language Models
        • QLORA and Fine-Tuning of Quantized Language Models (LMs)
        • ReLoRA: High-Rank Training Through Low-Rank Updates
        • SLoRA: Federated Parameter Efficient Fine-Tuning of Language Models
        • GaLora: Memory-Efficient LLM Training by Gradient Low-Rank Projection
      • Hyperparameters
        • Batch Size
        • Padding Tokens
        • Mixed precision training
        • FP8 Formats for Deep Learning
        • Floating Point Numbers
        • Batch Size and Model loss
        • Batch Normalisation
        • Rethinking Learning Rate Tuning in the Era of Language Models
        • Sample Packing
        • Gradient accumulation
        • A process for choosing the learning rate
        • Learning Rate Scheduler
        • Checkpoints
        • A Survey on Efficient Training of Transformers
        • Sequence Length Warmup
        • Understanding Training vs. Evaluation Data Splits
        • Cross-entropy loss
        • Weight Decay
        • Optimiser
        • Caching
      • Training Processes
        • Extending the context window
        • PyTorch Fully Sharded Data Parallel (FSDP)
        • Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation
        • YaRN: Efficient Context Window Extension of Large Language Models
        • Sliding Window Attention
        • LongRoPE
        • Reinforcement Learning
        • An introduction to reinforcement learning
        • Reinforcement Learning from Human Feedback (RLHF)
        • Direct Preference Optimization: Your Language Model is Secretly a Reward Model
  • INFERENCE
    • Why is inference important?
      • Grouped Query Attention
      • Key Value Cache
      • Flash Attention
      • Flash Attention 2
      • StreamingLLM
      • Paged Attention and vLLM
      • TensorRT-LLM
      • Torchscript
      • NVIDIA L40S GPU
      • Triton Inference Server - Introduction
      • Triton Inference Server
      • FiDO: Fusion-in-Decoder optimised for stronger performance and faster inference
      • Is PUE a useful measure of data centre performance?
      • SLORA
  • KNOWLEDGE
    • Vector Databases
      • A Comprehensive Survey on Vector Databases
      • Vector database management systems: Fundamental concepts, use-cases, and current challenges
      • Using the Output Embedding to Improve Language Models
      • Decoding Sentence-BERT
      • ColBERT: Efficient and Effective Passage Search via Contextualized Late Interaction over BERT
      • SimCSE: Simple Contrastive Learning of Sentence Embeddings
      • Questions Are All You Need to Train a Dense Passage Retriever
      • Improving Text Embeddings with Large Language Models
      • Massive Text Embedding Benchmark
      • RocketQAv2: A Joint Training Method for Dense Passage Retrieval and Passage Re-ranking
      • LLM2Vec: Large Language Models Are Secretly Powerful Text Encoders
      • Embedding and Fine-Tuning in Neural Language Models
      • Embedding Model Construction
      • Demystifying Embedding Spaces using Large Language Models
      • Fine-Tuning Llama for Multi-Stage Text Retrieval
      • Large Language Model Based Text Augmentation Enhanced Personality Detection Model
      • One Embedder, Any Task: Instruction-Finetuned Text Embeddings
      • Vector Databases are not the only solution
      • Knowledge Graphs
        • Harnessing Knowledge Graphs to Elevate AI: A Technical Exploration
        • Unifying Large Language Models and Knowledge Graphs: A Roadmap
      • Approximate Nearest Neighbor (ANN)
      • High Dimensional Data
      • Principal Component Analysis (PCA)
      • Vector Similarity Search - HNSW
      • FAISS (Facebook AI Similarity Search)
      • Unsupervised Dense Retrievers
    • Retrieval Augmented Generation
      • Retrieval-Augmented Generation for Large Language Models: A Survey
      • Fine-Tuning or Retrieval?
      • Revolutionising Information Retrieval: The Power of RAG in Language Models
      • A Survey on Retrieval-Augmented Text Generation
      • REALM: Retrieval-Augmented Language Model Pre-Training
      • Retrieve Anything To Augment Large Language Models
      • Generate Rather Than Retrieve: Large Language Models Are Strong Context Generators
      • Active Retrieval Augmented Generation
      • DSPy: LM Assertions: Enhancing Language Model Pipelines with Computational Constraints
      • DSPy: Compiling Declarative Language Model Calls
      • DSPy: In-Context Learning for Extreme Multi-Label Classification
      • Optimizing Instructions and Demonstrations for Multi-Stage Language Model Programs
      • HYDE: Revolutionising Search with Hypothetical Document Embeddings
      • Enhancing Recommender Systems with Large Language Model Reasoning Graphs
      • Retrieval Augmented Generation (RAG) versus fine tuning
      • RAFT: Adapting Language Model to Domain Specific RAG
      • Summarisation Methods and RAG
      • Lessons Learned on LLM RAG Solutions
      • Stanford: Retrieval Augmented Language Models
      • Overview of RAG Approaches with Vector Databases
      • Mastering Chunking in Retrieval-Augmented Generation (RAG) Systems
    • Semantic Routing
    • Resource Description Framework (RDF)
  • AGENTS
    • What is agency?
      • Rephrase and Respond: Let Large Language Models Ask Better Questions for Themselves
      • Types of Agents
      • The risk of AI agency
      • Understanding Personality in Large Language Models: A New Frontier in AI Psychology
      • AI Agents - Reasoning, Planning, and Tool Calling
      • Personality and Brand
      • Agent Interaction via APIs
      • Bridging Minds and Machines: The Legacy of Newell, Shaw, and Simon
      • A Survey on Language Model based Autonomous Agents
      • Large Language Models as Agents
      • AI Reasoning: A Deep Dive into Chain-of-Thought Prompting
      • Enhancing AI Reasoning with Self-Taught Reasoner (STaR)
      • Exploring the Frontier of AI: The "Tree of Thoughts" Framework
      • Toolformer: Revolutionising Language Models with API Integration - An Analysis
      • TaskMatrix.AI: Bridging Foundational AI Models with Specialised Systems for Enhanced Task Completion
      • Unleashing the Power of LLMs in API Integration: The Rise of Gorilla
      • Andrew Ng's presentation on AI agents
      • Making AI accessible with Andrej Karpathy and Stephanie Zhan
  • Regulation and Ethics
    • Regulation and Ethics
      • Privacy
      • Detecting AI Generated content
      • Navigating the IP Maze in AI: The Convergence of Blockchain, Web 3.0, and LLMs
      • Adverse Reactions to generative AI
      • Navigating the Ethical Minefield: The Challenge of Security in Large Language Models
      • Navigating the Uncharted Waters: The Risks of Autonomous AI in Military Decision-Making
  • DISRUPTION
    • Data Architecture
      • What is a data pipeline?
      • What is Reverse ETL?
      • Unstructured Data and Generatve AI
      • Resource Description Framework (RDF)
      • Integrating generative AI with the Semantic Web
    • Search
      • BM25 - Search Engine Ranking Function
      • BERT as a reranking engine
      • BERT and Google
      • Generative Engine Optimisation (GEO)
      • Billion-scale similarity search with GPUs
      • FOLLOWIR: Evaluating and Teaching Information Retrieval Models to Follow Instructions
      • Neural Collaborative Filtering
      • Federated Neural Collaborative Filtering
      • Latent Space versus Embedding Space
      • Improving Text Embeddings with Large Language Models
    • Recommendation Engines
      • On Interpretation and Measurement of Soft Attributes for Recommendation
      • A Survey on Large Language Models for Recommendation
      • Model driven recommendation systems
      • Recommender AI Agent: Integrating Large Language Models for Interactive Recommendations
      • Foundation Models for Recommender Systems
      • Exploring the Impact of Large Language Models on Recommender Systems: An Extensive Review
      • AI driven recommendations - harming autonomy?
    • Logging
      • A Taxonomy of Anomalies in Log Data
      • Deeplog
      • LogBERT: Log Anomaly Detection via BERT
      • Experience Report: Deep Learning-based System Log Analysis for Anomaly Detection
      • Log-based Anomaly Detection with Deep Learning: How Far Are We?
      • Deep Learning for Anomaly Detection in Log Data: A Survey
      • LogGPT
      • Adaptive Semantic Gate Networks (ASGNet) for log-based anomaly diagnosis
  • Infrastructure
    • The modern data centre
      • Enhancing Data Centre Efficiency: Strategies to Improve PUE
      • TCO of NVIDIA GPUs and falling barriers to entry
      • Maximising GPU Utilisation with Kubernetes and NVIDIA GPU Operator
      • Data Centres
      • Liquid Cooling
    • Servers and Chips
      • The NVIDIA H100 GPU
      • NVIDIA H100 NVL
      • Lambda Hyperplane 8-H100
      • NVIDIA DGX Servers
      • NVIDIA DGX-2
      • NVIDIA DGX H-100 System
      • NVLink Switch
      • Tensor Cores
      • NVIDIA Grace Hopper Superchip
      • NVIDIA Grace CPU Superchip
      • NVIDIA GB200 NVL72
      • Hopper versus Blackwell
      • HGX: High-Performance GPU Platforms
      • ARM Chips
      • ARM versus x86
      • RISC versus CISC
      • Introduction to RISC-V
    • Networking and Connectivity
      • Infiniband versus Ethernet
      • NVIDIA Quantum InfiniBand
      • PCIe (Peripheral Component Interconnect Express)
      • NVIDIA ConnectX InfiniBand adapters
      • NVMe (Non-Volatile Memory Express)
      • NVMe over Fabrics (NVMe-oF)
      • NVIDIA Spectrum-X
      • NVIDIA GPUDirect
      • Evaluating Modern GPU Interconnect
      • Scalable Hierarchical Aggregation and Reduction Protocol (SHARP)
      • Next-generation networking in AI environments
      • NVIDIA Collective Communications Library (NCCL)
    • Data and Memory
      • NVIDIA BlueField Data Processing Units (DPUs)
      • Remote Direct Memory Access (RDMA)
      • High Bandwidth Memory (HBM3)
      • Flash Memory
      • Model Requirements
      • Calculating GPU memory for serving LLMs
      • Transformer training costs
      • GPU Performance Optimisation
    • Libraries and Complements
      • NVIDIA Base Command
      • NVIDIA AI Enterprise
      • CUDA - NVIDIA GTC 2024 presentation
      • RAPIDs
      • RAFT
    • Vast Data Platform
      • Vast Datastore
      • Vast Database
      • Vast Data Engine
      • DASE (Disaggregated and Shared Everything)
      • Dremio and VAST Data
    • Storage
      • WEKA: A High-Performance Storage Solution for AI Workloads
      • Introduction to NVIDIA GPUDirect Storage (GDS)
        • GDS cuFile API
      • NVIDIA Magnum IO GPUDirect Storage (GDS)
      • Vectors in Memory
Powered by GitBook
LogoLogo

Continuum - Accelerated Artificial Intelligence

  • Continuum Website
  • Axolotl Platform

Copyright Continuum Labs - 2023

On this page
  • Key points
  • Academic Benchmarks
  • Key points
  • Weaknesses analysis
  • Conclusion
  • Three applications
  • Paper References

Was this helpful?

  1. MODELS
  2. Foundation Models

Phi-3 Technical Report

A Highly Capable Language Model Locally on Your Phone

PreviousPhi 2.0NextThe Fine Tuning Process

Last updated 1 year ago

Was this helpful?

This April 2024 paper from the team at Microsoft introduces phi-3-mini, a 3.8 billion parameter language model that achieves performance rivalling much larger models like Mixtral 8x7B and GPT-3.5, despite being small enough to run on a phone.

This feat was achieved solely by improving the training data, not by increasing model size.

This continues to Microsoft's work in training smaller language models such at Phi 1.5 and Phi 2.0.

Phi-3-mini's small size (3.8 billion parameters) enables it to run on devices like smartphones, opening up possibilities for local, private, and efficient applications.

Key points

Training data

The innovation lies in the dataset used for training phi-3-mini, which is a scaled-up version of the one used for phi-2. It consists of heavily filtered web data and synthetic data generated by language models.

Model architecture

phi-3-mini is a transformer decoder with a default context length of 4K tokens.

It has a similar block structure to Llama-2 and uses the same tokenizer with a vocabulary size of 320,641. The model has 3072 hidden dimensions, 32 heads, and 32 layers.

Training methodology

The authors focused on the quality of data for a given scale, aiming to calibrate the training data to be closer to the "data optimal" regime for small models.

They filtered web data to contain the correct level of "knowledge" and prioritised web pages that could potentially improve the model's reasoning ability.

Scaling results

The authors also provided initial parameter-scaling results with 7B and 14B models (phi-3-small and phi-3-medium) trained on 4.8T tokens. These models significantly outperform phi-3-mini on benchmarks like MMLU and MT-bench.

Post-training

phi-3-mini underwent supervised fine-tuning (SFT) and direct preference optimization (DPO) to improve its performance in math, coding, reasoning, robustness, and safety. This process also transformed the language model into an AI assistant suitable for user interaction.

Long context version

A long context version of phi-3-mini (phi-3-mini-128K) was developed using LongRope, extending the context length to 128K tokens while maintaining performance on par with the 4K version.

The achievement of creating a highly capable language model that can run on a phone is surprising because it challenges the assumption that larger models are always better.

By focusing on data quality and optimizing the training process, the researchers have demonstrated that smaller models can achieve impressive results when trained on the right data.

Academic Benchmarks

The next section of the paper discusses the performance of phi-3-mini on various academic benchmarks and compares it with other models such as phi-2, Mistral-7b, Mixtral-8x7b, Gemma 7B, Llama-3-instruct-8b, and GPT-3.5.

General Observation: We want to express our doubts about the use of these academic benchmarks to assess model quality. We may be seeing situations where model developers are using techniques to improve model performance on benchmarks by including them in the training data.

Key points

Benchmarks

The models are evaluated on a wide range of tasks, including common sense reasoning (e.g., PIQA, SociQA), logical reasoning (e.g., ANLI, GSM-8K), and domain-specific knowledge (e.g., MedQA, TriviaQA). The evaluation uses few-shot prompts (varying from 0 to 10 shots) at temperature 0.

Performance

phi-3-mini (3.8B parameters) achieves impressive results across most benchmarks, often outperforming larger models like Mistral-7b and Llama-3-instruct-8b.

It even rivals the performance of GPT-3.5 on some tasks (e.g., MMLU, HellaSwag, ANLI).

Scaling results

The preview results for phi-3-small (7B) and phi-3-medium (14B) show further improvements in performance, with phi-3-medium achieving an average score of 78.2% across the benchmarks, surpassing GPT-3.5's average of 75.3%.

Coding benchmarks

phi-3-mini performs exceptionally well on coding tasks like HumanEval (59.1%) and MBPP (70.0%), outperforming larger models like Mixtral-8x7b and GPT-3.5.

Overall, the paper demonstrates that phi-3-mini achieves remarkable performance on a wide range of benchmarks while maintaining a strong focus on safety and responsible AI principles.

The model's ability to rival larger models in terms of both performance and safety is a testament to the effectiveness of the training methodology and data optimisation techniques employed by the researchers.

Weaknesses analysis

The main weaknesses of phi-3-mini are:

Limited capacity for storing factual knowledge due to its small size, resulting in lower performance on tasks like TriviaQA that require a vast amount of factual information.

Restricted language capabilities, as the model is mostly trained on English data, limiting its multilingual performance.

Challenges common to most LMs, such as factual inaccuracies (hallucinations), reproduction or amplification of biases, inappropriate content generation, and safety issues, despite the efforts made to mitigate these problems.

Conclusion

phi-3-mini is a ground-breaking language model that demonstrates the potential of optimising training data and methodology to achieve impressive performance in a compact model size.

Despite its limitations in storing factual knowledge and multilingual capabilities, phi-3-mini rivals the performance of much larger models on a wide range of benchmarks while maintaining a strong focus on safety and responsible AI principles.

The model's ability to run on a phone while delivering high-quality results opens up new possibilities for applications that require on-device processing and privacy.

Three applications

Personal AI assistant

phi-3-mini's small size and strong performance make it an ideal candidate for a personal AI assistant that can run on a smartphone.

Users can interact with the model directly on their devices without the need for internet connectivity, ensuring privacy and faster response times. The assistant can help with tasks such as answering questions, providing recommendations, and offering creative writing suggestions.

Educational tool

phi-3-mini's strong performance on coding tasks like HumanEval and MBPP suggests that it can be used as an educational tool for students learning programming.

The model can provide explanations, generate code snippets, and offer guidance on coding best practices. Its ability to run on a phone makes it accessible to students in regions with limited internet access.

On-device customer support

phi-3-mini can be integrated into customer support applications that run on smartphones, allowing users to receive instant assistance without the need for an internet connection.

The model can answer common queries, provide troubleshooting steps, and guide users through various processes. Its strong language understanding and reasoning abilities ensure that users receive accurate and helpful responses, improving customer satisfaction and reducing the workload on human support staff.

Paper References

The phi-3-mini paper references a diverse set of prior work, including research on language model scaling, training methodologies, benchmarking, and responsible AI. The key areas covered by the referenced papers are:

Language model scaling and training

  • Scaling laws for neural language models [KMH+20]

  • Training compute-optimal large language models [HBM+22]

  • Scaling data-constrained language models [MRB+23]

Transformer architecture and attention mechanisms

  • Attention is all you need [VSP+17]

  • LongRope: Extending LLM context window beyond 2 million tokens [DZZ+24]

Previous work on phi models and training data optimisation

  • Textbooks are all you need [GZA+23]

  • Textbooks are all you need ii: phi-1.5 technical report [LBE+23]

  • phi-2: The surprising power of small language models [JBA+23]

Benchmarking and evaluation

  • MMLU [HBK+21], HellaSwag [ZHB+19], ANLI [NWD+20], GSM-8K [CKB+21], MedQA [JPO+20], AGIEval [ZCG+23], TriviaQA [JCWZ17], Arc-C/Arc-E [CCE+18], PIQA/SociQA [BZGC19], BigBench-Hard [SRR+22, SSS+22], WinoGrande [SLBBC19], OpenBookQA [MCKS18], BoolQ [CLC+19], CommonSenseQA [THLB19], TruthfulQA [LHE22], HumanEval [CTJ+21], MBPP [AON+21], GPQA [RHS+23], MTBench [ZCS+23]

Responsible AI and safety alignment

  • Training a helpful and harmless assistant with reinforcement learning from human feedback [BJN+22]

  • Beavertails: Towards improved safety alignment of LLM via a human-preference dataset [JLD+23]

  • Safety-tuned LLaMas: Lessons from improving the safety of large language models that follow instructions [BSA+24]

Other related language models

  • GPT-2 [RWC+19], Llama [TLI+23], Mistral [JSM+23], Mixtral [JSR+24], Gemma [TMH+24]

LogoPhi-3 Technical Report: A Highly Capable Language Model Locally on...arXiv.org
Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phone
Page cover image