<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by This Technology Life on Medium]]></title>
        <description><![CDATA[Stories by This Technology Life on Medium]]></description>
        <link>https://medium.com/@this.technology.life?source=rss-b12bf0083934------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*8dA7cX680vSe1-ux</url>
            <title>Stories by This Technology Life on Medium</title>
            <link>https://medium.com/@this.technology.life?source=rss-b12bf0083934------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 14:35:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@this.technology.life/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[An Easy Guide to Automated Prompt Engineering]]></title>
            <link>https://medium.com/@this.technology.life/an-easy-guide-to-automated-prompt-engineering-efdb8fdac960?source=rss-b12bf0083934------2</link>
            <guid isPermaLink="false">https://medium.com/p/efdb8fdac960</guid>
            <category><![CDATA[prompt-engineering]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[dspy]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[This Technology Life]]></dc:creator>
            <pubDate>Tue, 23 Sep 2025 23:01:47 GMT</pubDate>
            <atom:updated>2025-09-23T23:01:47.631Z</atom:updated>
            <content:encoded><![CDATA[<p>Prompt engineering is a crucial technique used to instruct Large Language Models (LLMs) and guide them toward generating task-specific responses. This is cheaper and faster than both fine-tuning and RAG, while taking less data, but has often been a manual task. For LLMs that are deployed on-device, which tend to be smaller (usually fewer than 14 billion parameters), it is even more important to have good prompts that are optimized for the task at hand as these cannot generalize to the same extent as larger LLMs.</p><p>In this article we will show you how to use Declarative Self-improving Python (DSPy), an automatic prompt engineering framework, along with Intel oneAPI Base Toolkit to create a pipeline for a specific task and optimize the prompts for that task on Intel Core Ultra Processors available on Intel AI PCs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*rHblp1WAPqJO-wJDyFPp6A.png" /></figure><h4>What is Automated Prompt Engineering Optimization?</h4><p>Automatic prompt engineering is a technique that takes an LLM and automatically creates increasingly better prompts. Any automatic prompt engineering framework requires the following:</p><ul><li>An LLM that needs to be prompt-engineered</li><li>A dataset of inputs and outputs for the task at hand</li><li>A metric that measures how well the LLM is doing on the task</li></ul><p>The automatic prompt engineering frameworks will then handle the prompt updates to make the LLM perform better on the given task.</p><h4>Get Started</h4><h4>DSPy and llama.cpp</h4><p>DSPy is an open source Python framework for programming LLMs for optimizing their prompts and weights. The philosophy relies around using code, contained in signatures, modules, and optimizers to create pipelines that can then be optimized. Compared to using pure string prompts, DSPy brings structure and modularity to LLM prompting, allowing for easy changes to be made while still being robust.</p><p>Llama.cpp is an LLM engine that accelerates LLM inference on local and edge devices. Llama.cpp brings SOTA LLM inference techniques and applies them to LLM inferencing and native hardware acceleration. Llama.cpp supports the SYCL backend, meaning that llama.cpp can run on Intel GPUs (integrated graphics, discrete graphics, or data centers).</p><p>To install Llama.cpp with SYCL support for python execution, set GGML_SYCL=on environment variable before installing, like shown below.</p><ul><li><em>Linux </em><br>CMAKE_ARGS=”-DGGML_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DGGML_SYCL_F16=ON” pip install llama-cpp-python</li><li><em>Windows </em><br>set CMAKE_GENERATOR=Ninja <br>set CMAKE_C_COMPILER=cl <br>set CMAKE_CXX_COMPILER=icx <br>set CXX=icx <br>set CC=cl <br>set CMAKE_ARGS=”-DGGML_SYCL=ON -DCMAKE_CXX_COMPILER=icx -DCMAKE_C_COMPILER=cl -DGGML_SYCL_F16=ON” pip install llama-cpp-python</li></ul><h4>Intel oneAPI Base Toolkit</h4><p>Intel oneAPI Base Toolkit includes different tools (for profiling, design assistance, and debug tools) and domain-specific libraries for developing high-performance, data-centric applications across various architectures such as Intel CPUs, GPUs, and FPGAs. It also allows you to easily migrate from CUDA* code to open standard multiarchitecture C++ with SYCL</p><h4>AI PCs</h4><p>AI PCs represent the new generation of personal computers to provide power efficient AI acceleration through the included central processing unit (CPU), graphic processing unit (GPU), and neural processing unit (NPU) in order to be able to handle a diverse range of AI workloads. AI PCs powered by Intel Core Ultra processors can balance power and performance for fast and efficient AI experiences. NPUs are specialized hardware designed for AI capabilities and allow the AI PC to perform a variety of AI tasks efficiently while delivering enhanced privacy and security.</p><h3>Code Sample</h3><p>This <a href="https://github.com/intel/AI-PC_Notebooks/tree/main/Automated-Prompt-Engineering">code sample</a> is available in the AI PC Notebooks GitHub Repository. Firstly, the dataset will be loaded and then DSPy framework is configured to optimize prompts for the LLM pipeline.</p><p>The following steps are implemented in the code sample and make sure to have the Intel oneAPI Base Toolkit installed before running the code sample.</p><ol><li><strong>Load Riddle Dataset:</strong> The dataset that we will be using is the ARC dataset. This dataset contains grade-level science questions paired with multiple choice answers. The task for the LLM is to predict the correct multiple-choice answer to answer the question. In many cases, one may not have a dataset ready for their task. For these cases, one would need to create examples themselves. DSPy can work with a few examples and then optimize the prompts for the task.</li></ol><pre>dataset = load_dataset(&quot;INK-USC/riddle_sense&quot;, split=&quot;validation&quot;)</pre><p><strong>2. Create Question Signature:</strong> DSPy uses signatures to define the input and output for the LLM. This will be represented as a class in Python. Inside this class, we define the input and output for the LLM. The input is the riddle, and the output is the correct answer to the riddle. We know that the correct answer for the LLM is the correct multiple-choice answer to the question, and we can use Python typing to define this. DSPy will use this signature to prompt the LLM and also add prompts around this signature during optimization.</p><pre>class Question(dspy.Signature): <br><br>&quot;&quot;&quot;Answer science questions by selecting the correct answer from a list of choices. Respond with the letter of the correct answer.&quot;&quot;&quot;  # noqa: E501 <br><br>riddle = dspy.InputField() <br><br>answer: Literal[&quot;A&quot;, &quot;B&quot;, &quot;C&quot;, &quot;D&quot;] = dspy.OutputField()</pre><p><strong>3. Process Dataset for DSPy:</strong> The next step is to convert the list of questions and answers to a format that DSPy can understand. DSPy takes in a list of dspy. Example objects that specify the science question and the correct answer. We will convert the riddles and answers to this format.</p><pre># Create dataset <br><br>dspy_dataset = [] <br><br>for row in dataset.itertuples(): <br><br>    # Extract data from row <br><br>    question = row.question <br><br>    answer = row.answer <br><br>    labels = row.choices[&quot;label&quot;] <br><br>    context = row.choices[&quot;text&quot;] <br><br>  <br><br>    # Create science question input based on the question and answer choices <br><br>    answer_choices = &quot;&quot; <br><br>    for label, choice in zip(labels, context): <br><br>        answer_choices += f&quot;{label}. {choice}, &quot; <br><br>    answer_choices = answer_choices[:-2]  # Remove trailing comma <br><br>    science_question = f&quot;{question}: {answer_choices}&quot; <br><br>  <br><br>    # Create example <br><br>    example = dspy.Example(science_question=science_question, answer=answer).with_inputs(&quot;science_question&quot;) <br><br>  <br><br>    # Append example to dataset <br><br>    dspy_dataset.append(example)</pre><p><strong>4. Load LLM using llama.cpp and configure DSPy to use LLM:</strong> After we select the LLM to be used, we will then load the LLM using llama-cpp-python, a Python wrapper for llama.cpp. The from_pretrained function will download the model and tokenizer from Huggingface and load it onto the machine. We will then use this LLM to prompt the riddles and answers. Once we have loaded the LLM, we need to configure DSPy to use this LLM. DSPy offers the LlamaCPP method which takes the llm object. DSPy will then use llama-cpp-python and the LLM to prompt the riddles and answers. The code sample builds llama-cpp-python with the SYCL backend using Intel oneAPI DPC++/C++ Compiler, which allows LLMs to run on Intel GPUs.</p><pre>llm = Llama.from_pretrained( <br><br>    repo_id=model_to_repo[model_dropdown.value], <br><br>    filename=model_dropdown.value, <br><br>    # This tells Llama.cpp to put 5 layers of the model on the GPU. <br><br>    # The rest of the model will run on the CPU. <br><br>    n_gpu_layers=5, <br><br>    seed=SEED, <br><br>    # Increase context window size to 4096 so that the model can see the entire riddle <br><br>    # Having a large enough window size is important for the prompt optimization part <br><br>    n_ctx=4096, <br><br>    verbose=False, <br><br>) <br><br>  <br><br>llamalm = dspy.LlamaCpp(model=&quot;llama&quot;, llama_model=llm, model_type=&quot;chat&quot;, seed=SEED) <br><br>dspy.settings.configure(lm=llamalm)</pre><p><strong>5. Set metric to evaluate LLM performance on task:</strong> The metric we will use for evaluating the LLM’s performance is answer_exact_match, which returns True if the LLM answer matches the correct answer exactly and False otherwise. We will use this metric to evaluate the LLM’s performance on the validation and test set.</p><pre>metric = dspy.evaluate.metrics.answer_exact_match </pre><p><strong>6. Define LLM pipeline:</strong> After we have our dataset, we then need to create a Module that represents our input and what prompt strategy the LLM should use. We will use the Module class from dspy to create a module that represents the input and output for the LLM. We will then use this module to create a pipeline that will be optimized by DSPy. Here, we make sure to use our Question signature to specify the input and output we want from the LLM. Then, we will use dspy.ChainOfThought to tell DSPy to use Chain-Of-Thought prompt-engineering strategy.</p><pre>class QuestionAnsweringAI(dspy.Module): <br><br>    def __init__(self): <br><br>        self.signature = Riddle <br><br>        self.respond = dspy.ChainOfThought(self.signature) <br><br>  <br><br>    def forward(self, science_question): <br><br>        return self.respond(science_question=science_question) </pre><p><strong>7. Configure LLM evaluation:</strong> Now that we have defined the inputs, outputs, and the LLM pipeline, we then need to have a strategy to evaluate the LLM’s performance with new prompts. We will use dspy. Evaluate function to accept a dataset, metric, and start the evaluation process.</p><pre>train_evaluate = dspy.Evaluate( <br>    devset=train, metric=metric, num_threads=1, display_progress=True, display_table=10 <br>) <br>val_evaluate = dspy.Evaluate( <br>    devset=val, metric=metric, num_threads=1, display_progress=True, display_table=10 <br>) <br>test_evaluate = dspy.Evaluate( <br>    devset=test, metric=metric, num_threads=1, display_progress=True, display_table=10 <br>) </pre><p><strong>8. Configure and execute DSPy optimizer:</strong> DSPy offers a variety of different optimizers to find the best prompts. We will use the MIPROv2 to find better prompts for the LLM. MIPROv2 is a prompt-engineering optimizer. MIPROv2 contains hyperparameters that control how long it takes to find prompts as well. We will use the light setting for the hyperparameters.</p><pre>optm = dspy.MIPROv2(metric=metric, auto=&quot;light&quot;, num_threads=1, seed=SEED) <br><br>  <br><br>optimized_riddle_answerer = optm.compile( <br><br>    QuestionAnsweringAI(), <br><br>    trainset=train, <br><br>    valset=val, <br><br>    # The number of examples that is generated and included in the prompt <br><br>    max_bootstrapped_demos=2, <br><br>    # The number of examples from the training set that is included in the prompt <br><br>    max_labeled_demos=2, <br><br>    requires_permission_to_run=False, <br><br>) </pre><p><strong>9. Compare accuracy before and after optimization:</strong> Finally, we will display the accuracy of the LLM before and after prompt engineering. The LLM on the test set without optimization scored 35% accuracy whereas the optimized LLM scored 78% accuracy.</p><p>Try out the above code sample for yourself and learn how to optimize prompts with DSPy on Intel GPUs.</p><h3>What’s Next</h3><p>We hope that this article and code sample introduces developers to LLM evaluation and prompt optimization, while allowing LLMs to run performantly on Intel GPUs with the Intel oneAPI Base Toolkit. If your LLM customization needs exceed the capabilities of automated prompt engineering, we encourage you to dive into our RAG and fine-tuning resources.</p><p>We encourage you to also check out and incorporate Intel’s other AI/ML Framework optimizations and tools into your AI workflow.</p><p><strong>First published location: </strong><a href="https://www.intel.com/content/www/us/en/developer/articles/technical/automated-prompt-engineering-on-intel-gpus.html">https://www.intel.com/content/www/us/en/developer/articles/technical/automated-prompt-engineering-on-intel-gpus.html</a></p><p><strong>First published date: </strong>03/24/2025</p><p><strong>Authors:</strong></p><p><em>Ramya Ravi, AI software marketing engineer</em></p><p><em>Gururaj Deshpande, Graduate Intern Technical</em></p><p><em>Chandan Damannagari, Director, AI Software</em></p><p><em>Intel Corporation</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=efdb8fdac960" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Accelerating the Development and Use of Trustworthy Generative AI for Science and Engineering]]></title>
            <link>https://medium.com/@this.technology.life/accelerating-the-development-and-use-of-trustworthy-generative-ai-for-science-and-engineering-0bcabbaea043?source=rss-b12bf0083934------2</link>
            <guid isPermaLink="false">https://medium.com/p/0bcabbaea043</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[science]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[generative-ai-use-cases]]></category>
            <dc:creator><![CDATA[This Technology Life]]></dc:creator>
            <pubDate>Mon, 22 Sep 2025 21:47:45 GMT</pubDate>
            <atom:updated>2025-09-22T21:47:45.490Z</atom:updated>
            <content:encoded><![CDATA[<p>The <a href="https://tpc.dev/">Trillion Parameter Consortium (TPC)</a> is a collaboration between academic and research institute partners, industry, and vendors, along with labs and HPC centers that host some of the world’s most powerful supercomputers. It is a broad “AI for Science” community that aims to work together to create models for science and engineering use cases, that are at the scale of the largest private models, by collaborating on datasets and model training while sharing compute cycles.</p><p>Argonne National Laboratory and Intel have been working together on a Large Language Model (LLM) based AI Generative Pretrained Transformer (GPT) solution dubbed Aurora GPT, specifically for assisting with extremely high variable parameter count scientific problems running on the Intel Xeon Scalable Processor and Intel Data Center GPU Max Series based Aurora Exascale Supercomputer.</p><p>The intent is to “combine all the text, codes, specific scientific results, papers, into the model that science can use to speed up research,” as Ogi Brkic Vice President and General Manager, Super Computing Product Line at Intel put it. This collaboration soon expanded, and expressing the spirit of collaboration across thescience, artificial intelligence, and high-performance computing community, it led to the founding of the TPC on November 10, 2023.</p><h4>Join the European Kick-Off Workshop of the Trillion Parameter Consortium (TPC)</h4><p>Later this month, scientists from around the world will join a workshop discussing how to leverage the predictive power of Large Language Models (LLMs) across scientific domains. For 3 days they will work on</p><ol><li>AI methods, natural language processing, multimodal approaches and architectures,</li><li>hardware and software systems,</li><li>uses and detailed implementations taking advantage of the resulting AI systems across science, engineering, medicine, and other domains.</li></ol><p><em>TPC European Kick-Off Workshop</em></p><ul><li><em>Date: 19–21 June 2024</em></li><li><em>Venue: Occidental Atenea Mar, Barcelona, Spain</em></li><li><em>Hosted by the Barcelona Supercomputing Center</em></li><li><em>Registration</em></li></ul><p>It will be a forum for focused in-depth discussions driving towards a shared vision and goal, particularly aimed at accelerating the use of generative AI in science and engineering.</p><p>The workshop program includes:</p><ol><li>An optional half-day tutorial, led by instructors from University of Chicago and Argonne National Laboratory (ANL) on LLMs for Science and Engineering Applications</li><li>Plenary sessions with invited talks covering</li></ol><ul><li>Vision for Large-scale AI for Science</li><li>Major National and International Funding Initiatives at the Nexus of AI and HPC</li><li>Insights from Building Large-scale AI Models for Science</li><li>Trustworthy and Responsible AI.</li></ul><p>At the heart of the workshop are parallel breakout sessions with some leading scientists in their fields, designed to explore and pursue collaborations, covering topics ranging from model architecture and performance to skills, safety, and trust evaluation to bioinformatics and treatment design.</p><h4>More on the Trillion Parameter Consortium</h4><p>Through the TPC, the minds of the global scientific community come together with a single purpose:</p><p><strong><em>To address the challenges of building large-scale artificial intelligence (AI) systems and advancing trustworthy and reliable AI for scientific discovery.</em></strong></p><p>The result is a thriving community of over 70 organizations and 500 participants in a common Slack workspace is engaged in creating large-scale generative AI models to address key challenges in advancing AI for science.</p><p>This includes, but is not limited to:</p><ul><li>Developing scalable model architectures and training strategies</li><li>Organizing and curating scientific data for training models</li><li>Optimizing AI libraries for current and future exascale computing platforms</li><li>Developing deep evaluation platforms to assess progress on scientific task learning and reliability and trust.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/0*noQypBK-rDiwMKPa" /></figure><p>Today, Intel is excited to be an active contributor to the Trillion Parameter Consortium and its spirit of embracing collaboration, open standards, and AI solution scalability across multiarchitecture platforms including CPUs, GPUs, NPUs and specialized AI accelerators.</p><p>We encourage you to learn more and become a contributor to defining the role of AI in Science and Engineering and be at the forefront of the discussions that help define the next generation of reliable, trustworthy, and powerful research powered by AI.</p><p><strong>First published location: </strong><a href="https://community.intel.com/t5/Blogs/Tech-Innovation/Artificial-Intelligence-AI/Accelerating-the-Development-and-Use-of-Trustworthy-Generative/post/1606661">https://community.intel.com/t5/Blogs/Tech-Innovation/Artificial-Intelligence-AI/Accelerating-the-Development-and-Use-of-Trustworthy-Generative/post/1606661</a></p><p><strong>First published date: </strong>06/13/24</p><p><strong>Contributors:</strong></p><p><em>Rob Mueller-Albrecht,</em> <em>Product Marketing Manager</em></p><p><em>Chandan Damannagari, Director, AI Software</em></p><p><em>Intel Corporation</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0bcabbaea043" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an End-to-End Language Identification AI Solution using PyTorch]]></title>
            <link>https://medium.com/@this.technology.life/building-an-end-to-end-language-identification-ai-solution-using-pytorch-23290bab377a?source=rss-b12bf0083934------2</link>
            <guid isPermaLink="false">https://medium.com/p/23290bab377a</guid>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[language-model]]></category>
            <category><![CDATA[hugging-face]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[This Technology Life]]></dc:creator>
            <pubDate>Sun, 21 Sep 2025 20:31:48 GMT</pubDate>
            <atom:updated>2025-09-21T20:31:48.093Z</atom:updated>
            <content:encoded><![CDATA[<p>Language Identification is the process of identifying the primary language from multiple audio input samples. In natural language processing (NLP), language identification is an important problem and a challenging issue. There are many language-related tasks such as entering text on your phone, finding news articles you enjoy, or discovering answers to questions that you may have. All these tasks are powered by NLP models. To decide which model to invoke at a particular point in time, we must perform language identification.</p><p>This article presents an in-depth solution and code sample for language identification using Intel Extension for PyTorch, which is a version of the popular PyTorch AI framework optimized for use on Intel processors, and Intel Neural Compressor, which is a tool to accelerate AI inference without sacrificing accuracy.</p><p>The <a href="https://github.com/oneapi-src/oneAPI-samples/tree/master/AI-and-Analytics/End-to-end-Workloads/LanguageIdentification">code sample</a> demonstrates how to train a model to perform language identification using the Hugging Face SpeechBrain toolkit, the Hugging Face datasets library, and optimizing it using the Intel AI tools. The user can modify the code sample and identify up to 133 languages using the Common Voice dataset.</p><h3>Proposed Methodology for Language Identification</h3><p>In the proposed solution, the user will use Intel AI Tools to train a model and perform inference leveraging using Intel-optimized libraries for PyTorch. There is also an option to quantize the trained model with Intel Neural Compressor to speed up inference.</p><h3>Dataset</h3><p>The Common Voice dataset is used and for this code sample, specifically, Common Voice Corpus 11.0 for Japanese and Swedish. This dataset is used to train an Emphasized Channel Attention, Propagation and Aggregation Time Delay Neural Network (ECAPA-TDNN), which is implemented using the Hugging Face SpeechBrain library. Time Delay Neural Networks (TDNNs), aka one-dimensional Convolutional Neural Networks (1D CNNs), are multilayer artificial neural network architectures whose purpose is to classify patterns with shift-invariance and model context at each layer of the network. ECAPA-TDNN is a new TDNN-based speaker-embedding extractor for speaker verification; it is built upon the original x-vector architecture and puts more emphasis on channel attention, propagation, and aggregation.</p><h3>Implementation</h3><h4>Dataset Download</h4><p>The Common Voice dataset version 11 is available on Huggingface Datasets. The code sample contains a convienent script to download the dataset. The following are the options for the dataset download script scripts (dataset.py) can be run with:</p><p>Input Option Description — output_dir Specify the data path. Default is /data/commonVoice</p><p>After downloading the Common Voice dataset, the data is preprocessed by converting the MP3 files into WAV format to avoid information loss and separated into training, validation, and testing sets.</p><p>A pretrained VoxLingua107 model is retrained with the Common Voice dataset using the Hugging Face SpeechBrain library to focus on the languages of interest. VoxLingua107 is a speech dataset used for training spoken language recognition models that work well with real-world and varying speech data. This dataset contains data for 107 languages. By default, the model will be finetuned with the Japanese and Swedish datasets, but more languages can be included. This finetuned model is then used for inference on the testing dataset or a user-specified dataset. Also, there is an option to utilize SpeechBrain’s Voice Activity Detection (VAD) where only the speech segments from the audio files are extracted and combined before samples are randomly selected as input into the model. To improve performance, the user may quantize the trained model to integer-8 (INT8) using Intel Neural Compressor to decrease latency.</p><h4>Training</h4><p>Copies of the training scripts are added to the current working directory, including create_wds_shards.py — for creating the WebDataset shards, train.py — to perform the actual training procedure, and train_ecapa.yaml — to configure the training options. The script to create WebDataset shards and YAML file are patched to work with the two languages chosen for this code sample.</p><p>In the data preprocessing phase, prepareAllCommonVoice.py script is executed to randomly select a specified number of samples to convert the input from MP3 to WAV format. Here, 80% of these samples will be used for training, 10% for validation, and 10% for testing. At least 2000 samples are recommended as the number of input samples and is the default value.</p><p>In the next step, WebDataset shards are created from the training and validation datasets. This stores the audio files as tar files which allows writing purely sequential I/O pipelines for large-scale deep learning to achieve high I/O rates from local storage — about 3x-10x faster compared to random access.</p><p>The YAML file will be modified by the user. This includes setting the value for the largest number for the WebDataset shards, output neurons to the number of languages of interest, number of epochs to train over the entire dataset, and the batch size. The batch size should be decreased if the CPU or GPU runs out of memory while running the training script.</p><p>In this code sample, the training script will be executed with CPU. While running the script, “cpu” will be passed as an input parameter. The configurations defined in train_ecapa.yaml are also passed as parameters.</p><p>The command to run the script to train the model is:</p><pre>python train.py train_ecapa.yaml --device &quot;cpu&quot;</pre><p>In the future, the training script train.py can be modified to work for Intel GPUs such as the Intel Data Center GPU Flex Series,Data Center GPU Max Series, and Arc A-Series with updates from Intel Extension for PyTorch.</p><p>Run the training script to learn how to train the models and execute the training script. The 4th Generation Intel Xeon Scalable Processor or newer is recommended for this transfer learning application because of its performance improvements through its Intel Advanced Matrix Extensions (AMX) instruction set.</p><p>After training, checkpoint files are available. These files are used to load the model for inference.</p><h4>Inference</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UEk0IxcJHao6oEEq.png" /></figure><p>Users can choose to run inference using the testing set from Common Voice or their own custom data in WAV format. The following are the options the inference scripts (inference_custom.py and inference_commonVoice.py) can be run with:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*AUGz22ci5FO9dy_N4P1XIw.png" /></figure><p>The path to the data must be specified. By default, 100 audio samples of 3-seconds will be randomly selected from the original audio file and used as input to the language identification model.</p><p>A small Convolutional Recurrent Deep Neural Network (CRDNN) pretrained on the <a href="https://drive.google.com/file/d/1--cAS5ePojMwNY5fewioXAv9YlYAWzIJ/view">LibriParty</a> dataset is used to process audio samples and output the segments where speech activity is detected. This can be used in inference with the — vad option.</p><p>From the figure below, the timestamps where speech will be detected is delivered from the CRDNN model, and these are used to construct a new, shorter audio file with only speech. Sampling from this new audio file will give a better prediction of the primary language spoken.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Kp1CgHdk27tR7c_T.png" /></figure><p>Run the inference script yourself. An example command of running inference:</p><pre>python inference_custom.py -p data_custom -d 3 -s 50 --vad</pre><p>This will run inference on data you provide located inside the data_custom folder. This command performs inference on 50 randomly selected 3-second audio samples with voice activity detection.</p><p>If you want to run the code sample for other languages, download Common Voice Corpus 11.0 datasets for other languages.</p><h3>Optimizations with Intel Extension for PyTorch and Intel Neural Compressor</h3><h3>PyTorch</h3><p>The Intel extension expands PyTorch with up-to-date features and optimizations for an extra performance boost on Intel hardware. Check out how to install Intel Extension for PyTorch. The extension can be loaded as a Python module or linked as a C++ library. Python users can enable it dynamically by importing intel_extension_for_pytorch.</p><ul><li>The CPU tutorial gives detailed information about Intel Extension for PyTorch for Intel CPUs. Source code is available at the master branch.</li><li>The GPU tutorial gives detailed information about Intel Extension for PyTorch for Intel GPUs. Source code is available at the xpu-master branch.</li></ul><p>To optimize the model for inference using Intel Extension for PyTorch, the — ipex<em> </em>option can be passed in. The model is optimized using the plug-in. TorchScript speeds up inference because PyTorch is run in graph mode. The command to run with this optimization is:</p><pre>python inference_custom.py -p data_custom -d 3 -s 50 --vad --ipex -–verbose</pre><p>Note: The — verbose option is required to view the latency measurements.</p><p>Auto-mixed precision such as bfloat16 (BF16) support will be added in a future release of the code sample.</p><h3>Intel Neural Compressor</h3><p>This is an open-source Python library that runs on CPUs or GPUs, which:</p><ul><li>Performs model quantization to reduce the model size and increase the speed of deep learning inference for deployment.</li><li>Automates popular methods such as quantization, compression, pruning, and knowledge distillation across multiple deep-learning frameworks.</li><li>Is part of the AI Kit</li></ul><p>The model can be quantized from float32 (FP32) precision to integer-8 (INT8) by running the quantize_model.py script while passing in the path to the model and a validation dataset. The following code can be used to load this INT8 model for inference:</p><pre>from neural_compressor.utils.pytorch import load<br>model_int8 = load(&quot;./lang_id_commonvoice_model_INT8&quot;, self.language_id)<br>signal = self.language_id.load_audio(data_path)<br>prediction = self.model_int8(signal)</pre><p>Note that the original model is required when loading the quantized model. The command to quantize the trained model from FP32 to INT8 by using quantize_model.py is:</p><pre>python quantize_model.py -p ./lang_id_commonvoice_model -datapath $COMMON_VOICE_PATH/commonVoiceData/commonVoice/dev</pre><h3>What’s Next?</h3><p>Try out the above code sample on a 4th Generation Intel Xeon Scalable Processor with Intel AMX and identify up to 93 different languages from Common Voice datasets. We encourage you to also learn more about and incorporate Intel’s other AI/ML Framework optimizations and tools into your AI workflow.</p><p>For more details about the new 4th Gen Intel Xeon Scalable processors, visit Intel’s AI Solution Platform portal where you can learn how Intel is empowering developers to run end-to-end AI pipelines on these powerful CPUs.</p><p><strong>First published location: </strong><a href="https://www.intel.com/content/www/us/en/developer/articles/technical/language-identification-solution-using-pytorch.html">https://www.intel.com/content/www/us/en/developer/articles/technical/language-identification-solution-using-pytorch.html</a></p><p><strong>First published date: </strong>01/03/2025</p><p><strong>Authors:</strong></p><p><em>Ramya Ravi, AI software marketing engineer</em></p><p><em>Alex Sin, AI software solutions engineer</em></p><p><em>Chandan Damannagari, Director, AI Software</em></p><p><em>Intel Corporation</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23290bab377a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an AI Job Recommendation System with TensorFlow]]></title>
            <link>https://medium.com/@this.technology.life/building-an-ai-job-recommendation-system-with-tensorflow-ce33f900c9bb?source=rss-b12bf0083934------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce33f900c9bb</guid>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[recommendation-system]]></category>
            <category><![CDATA[jobs]]></category>
            <category><![CDATA[ai-tools]]></category>
            <dc:creator><![CDATA[This Technology Life]]></dc:creator>
            <pubDate>Sat, 20 Sep 2025 19:17:45 GMT</pubDate>
            <atom:updated>2025-09-20T19:17:45.508Z</atom:updated>
            <content:encoded><![CDATA[<p>Recommendation Systems are a crucial part of our daily digital experience, transforming how users interact with digital platforms by providing relevant and interesting information based on data. These systems help users to discover products, content, and services tailored to their preferences. Examples abound ranging from Netflix and Amazon to Zillow and Goodreads.</p><p>In this article, we will show you how to build an end-to-end job recommendation system using Intel Extension for TensorFlow, from initial data exploratory analysis to providing relevant job opportunities. Whether you are a data scientist, engineer or a developer, this guide will provide you with step-by-step explanations to create an efficient recommendation system using easy to use tools and optimizations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*U61eFRfOrrsdyy0HjVixJQ.png" /></figure><h4>TensorFlow* Optimizations from Intel</h4><p>Intel collaborates with Google to upstream most optimizations to open source TensorFlow with the newest optimizations and features being released earlier as Intel Extension for TensorFlow. These optimizations can be enabled with a few lines of code and will accelerate TensorFlow-based training and inference performance on Intel CPU and GPU hardware.</p><h4>Code Sample Workflow</h4><p>This <a href="https://github.com/oneapi-src/oneAPI-samples/tree/main/AI-and-Analytics/End-to-end-Workloads/JobRecommendationSystem">code sample</a> demonstrates the end-to-end workflow to build a job recommendation system. It consists of four parts:</p><ol><li>Data exploration and visualization — provides information on how the dataset looks like, main features of the data and data distribution.</li><li>Data cleaning and pre-processing — removal of duplicates, steps required for text pre-processing.</li><li>Fraud job postings removal — find which of the job postings are fake using Long Short-Term Memory Deep Neural Network (LSTM DNN) and filtering them. LSTM DNN is based on recurrent neural network architecture, and they are designed to recognize patterns in sequences of data, with the ability to remember long-term dependencies by incorporating memory cells that maintain information over extended time intervals.</li><li>Job recommendation — calculates and provides top-n job descriptions like the chosen one.</li></ol><p>Let’s now review each of the parts in detail.</p><h4>I. Data exploration and visualization</h4><p>1. Load the dataset — We will use Real or Fake: Fake Job Postings dataset available over Hugging Face API datasets library.</p><pre>from datasets import load_dataset<br>dataset = load_dataset(&quot;victor/real-or-fake-fake-jobposting-prediction&quot;)<br>dataset = dataset[&#39;train&#39;]</pre><p>2. Analyze and understand the data — we will transform it to pandas DataFrame.</p><pre>import pandas as pd<br>df = dataset.to_pandas()<br>df.head()<br>df.tail()<br>df.info()</pre><p>3. Remove duplicates in the dataset — use drop_duplicates method.</p><pre>df = df.drop(columns=[&#39;job_id&#39;])<br>df = df.drop_duplicates()<br>print(df.duplicated().sum())</pre><p>4. Visualize the dataset — It can be challenging to visualize the text data. There is a wordcloud library that shows common words in the analyzed texts. The bigger the word is, the more often the word is in the text. In our example, we will create wordcloud for job titles, to have a high-level overview of job postings we are working with.</p><pre>from wordcloud import WordCloud # module to print word cloud<br>from matplotlib import pyplot as plt<br>import seaborn as sns<br><br># On the basis of Job Titles form word cloud<br>job_titles_text = &#39; &#39;.join(df[&#39;title&#39;])<br>wordcloud = WordCloud(width=800, height=400, background_color=&#39;white&#39;).generate(job_titles_text)<br><br># Plotting Word Cloud<br>plt.figure(figsize=(10, 6))<br>plt.imshow(wordcloud, interpolation=&#39;bilinear&#39;)<br>plt.title(&#39;Job Titles&#39;)<br>plt.axis(&#39;off&#39;)<br>plt.tight_layout()<br>plt.show()</pre><p>5. Show the top-n most common values in the given column or distribution of the values in this column — For example top 10 most common job titles and same can be done for all the columns.</p><pre>job_title_counts = df[&#39;title&#39;].value_counts()<br><br># Plotting a bar chart for the top 10 most common job titles<br>top_job_titles = job_title_counts.head(10)<br>plt.figure(figsize=(10, 6))<br>top_job_titles.sort_values().plot(kind=&#39;barh&#39;)<br>plt.title(&#39;Top 10 Most Common Job Titles&#39;)<br>plt.xlabel(&#39;Frequency&#39;)<br>plt.ylabel(&#39;Job Titles&#39;)<br>plt.show()</pre><h4>II. Data cleaning and pre-processing</h4><p>1. Data cleaning and pre-processing — For texts, data cleaning and pre-processing usually includes removal of stop words, special characters, numbers or any additional noise like hyperlinks. We will first combine all relevant columns into a single new record.</p><pre># List of columns to concatenate<br>columns_to_concat = [&#39;title&#39;,&#39;location&#39;,&#39;department&#39;,&#39;salary_range&#39;, &#39;company_profile&#39;,&#39;description&#39;,&#39;requirements&#39;,&#39;benefits&#39;,&#39;employment_type&#39;,<br>&#39;required_experience&#39;,&#39;required_education&#39;,&#39;industry&#39;,&#39;function&#39;]<br><br># Concatenate the values of specified columns into a new column &#39;job_posting&#39;<br>df[&#39;job_posting&#39;] = df[columns_to_concat].apply(lambda x: &#39; &#39;.join(x.dropna().astype(str)), axis=1)<br><br># Create a new DataFrame with columns &#39;job_posting&#39; and &#39;fraudulent&#39;<br>new_df = df[[&#39;job_posting&#39;, &#39;fraudulent&#39;]].copy()</pre><p>2. Pre-process the data by removing white characters (newlines, carriage returns, and tabs), URLs, special characters, digits. At the end, we will transform all the text to lower case and remove stop words.</p><pre>import re<br>import nltk<br>from nltk.corpus import stopwords<br><br>nltk.download(&#39;stopwords&#39;)<br><br>def preprocess_text(text):<br>    # Remove newlines, carriage returns, and tabs<br>    text = re.sub(&#39;\n&#39;,&#39;&#39;, text)<br>    text = re.sub(&#39;\r&#39;,&#39;&#39;, text)<br>    text = re.sub(&#39;\t&#39;,&#39;&#39;, text)<br>    # Remove URLs<br>    text = re.sub(r&quot;http\S+|www\S+|https\S+&quot;, &quot;&quot;, text, flags=re.MULTILINE)<br><br>    # Remove special characters<br>    text = re.sub(r&quot;[^a-zA-Z0-9\s]&quot;, &quot;&quot;, text)<br><br>    # Remove punctuation<br>    text = re.sub(r&#39;[^\w\s]&#39;, &#39;&#39;, text)<br><br>    # Remove digits<br>    text = re.sub(r&#39;\d&#39;, &#39;&#39;, text)<br><br>    # Convert to lowercase<br>    text = text.lower()<br><br>    # Remove stop words<br>    stop_words = set(stopwords.words(&#39;english&#39;))<br>    words = [word for word in text.split() if word.lower() not in stop_words]<br>    text = &#39; &#39;.join(words)<br><br>    return text<br><br>new_df[&#39;job_posting&#39;] = new_df[&#39;job_posting&#39;].apply(preprocess_text)</pre><p>3. Lemmatization — It is a process to reduce a word to its root form, called a lemma.</p><pre>import en_core_web_sm<br><br>nlp = en_core_web_sm.load()<br><br>def lemmatize_text(text):<br>    doc = nlp(text)<br>    return &quot; &quot;.join([token.lemma_ for token in doc])<br><br>new_df[&#39;job_posting&#39;] = new_df[&#39;job_posting&#39;].apply(lemmatize_text)</pre><h4>III. Fraud job postings removal</h4><p>Nowadays, not all the job offers posted on popular portals are genuine. Few of the job postings are created only to collect personal data. Therefore, just detecting fake job postings can be very essential. To detect fake job postings, we will create a bidirectional LSTM model with one hot encoding.</p><p>1. Import all the necessary libraries and make sure to use TensorFlow version 2.15.0.</p><pre>from tensorflow.keras.layers import Embedding<br>from tensorflow.keras.preprocessing.sequence import pad_sequences<br>from tensorflow.keras.models import Sequential<br>from tensorflow.keras.preprocessing.text import one_hot<br>from tensorflow.keras.layers import Dense<br>from tensorflow.keras.layers import Bidirectional<br>from tensorflow.keras.layers import Dropout<br>import tensorflow as tf<br>tf.__version__</pre><p>2. Now, import Intel Extension for TensorFlow. We are using Python API itex.experimental_ops_override(). It automatically replaces some TensorFlow operators with Custom Operators under itex.ops namespace, as well as to be compatible with existing trained parameters.</p><pre>import intel_extension_for_tensorflow as itex<br><br>itex.experimental_ops_override()</pre><p>3. Prepare data for the model we create — assign job_postings to X and fraudulent values to y (expected value).</p><pre>X = new_df[&#39;job_posting&#39;]<br>y = new_df[&#39;fraudulent&#39;]</pre><p>4. One hot encoding — One hot encoding is a technique to represent categorical variables as numerical values.</p><pre>voc_size = 5000<br>onehot_repr = [one_hot(words, voc_size) for words in X]<br><br>sent_length = 40<br>embedded_docs = pad_sequences(onehot_repr, padding=&#39;pre&#39;, maxlen=sent_length)<br>print(embedded_docs)</pre><p>5. Create the model — we are creating a Deep Neural Network using Bidirectional LSTM. The architecture will have embedding layer, bidirectional LSTM layer, dropout layer and dense layer with sigmoid function. We are using Adam optimizer with binary cross entropy. If Intel Extension for TensorFlow backend is XPU, tf.keras.layers.LSTM will be replaced by itex.ops.ItexLSTM.</p><pre>embedding_vector_features = 50<br>model_itex = Sequential()<br>model_itex.add(Embedding(voc_size, embedding_vector_features, input_length=sent_length))<br>model_itex.add(Bidirectional(itex.ops.ItexLSTM(100)))<br>model_itex.add(Dropout(0.3))<br>model_itex.add(Dense(1, activation=&#39;sigmoid&#39;))<br>model_itex.compile(loss=&#39;binary_crossentropy&#39;, optimizer=&#39;adam&#39;, metrics=[&#39;accuracy&#39;])<br>print(model_itex.summary())</pre><p>6. Split our data into training and testing datasets.</p><pre>X_final = np.array(embedded_docs)<br>y_final = np.array(y)<br><br>from sklearn.model_selection import train_test_split<br>X_train, X_test, y_train, y_test = train_test_split(X_final, y_final, test_size=0.25, random_state=320)</pre><p>7. Train the model — we will use the standard model.fit() method and provide training and testing dataset.</p><pre>model_itex.fit(X_train, y_train, validation_data=(X_test, y_test), epochs=1, batch_size=64)</pre><p>8. The values returned by the model are in the range [0,1]. So, we need to map them to integer values of 0 or 1.</p><pre>y_pred = (model_itex.predict(X_test) &gt; 0.5).astype(&quot;int32&quot;)</pre><p>9. To demonstrate the effectiveness of our models we presented the confusion matrix and classification report available within the scikit-learn library.</p><pre>from sklearn.metrics import ConfusionMatrixDisplay, confusion_matrix, classification_report<br><br>conf_matrix = confusion_matrix(y_test, y_pred)<br>print(&quot;Confusion matrix:&quot;)<br>print(conf_matrix)<br><br>ConfusionMatrixDisplay.from_predictions(y_test, y_pred)<br><br>class_report = classification_report(y_test, y_pred)<br>print(&quot;Classification report:&quot;)<br>print(class_report)</pre><h4>IV. Job recommendation</h4><p>For job recommendations, we will use a much simpler solution. To show similar job postings, we will use the classical machine learning algorithms.</p><p>1. Filter fake job postings.</p><pre>real = df[df[&#39;fraudulent&#39;] == 0]</pre><p>2. Create a common column containing the relevant text parameters. They will be used to compare job postings between each other and make recommendations.</p><pre>real = real.fillna(value=&#39;&#39;)<br>real[&#39;text&#39;] = real[&#39;description&#39;] + real[&#39;requirements&#39;] + real[&#39;required_experience&#39;] + real[&#39;required_education&#39;] + real[&#39;industry&#39;]</pre><p>3. Prepare recommendations — we will use sentence similarity based on prepared text column in our database.</p><pre>from sentence_transformers import SentenceTransformer<br>model = SentenceTransformer(&#39;sentence-transformers/all-MiniLM-L6-v2&#39;)</pre><p>4. Prepare functions to show similarities between given sentences using a heat map.</p><pre>import numpy as np<br>import seaborn as sns<br><br>def plot_similarity(labels, features, rotation):<br>  corr = np.inner(features, features)<br>  sns.set(font_scale=1.2)<br>  g = sns.heatmap(<br>      corr,<br>      xticklabels=labels,<br>      yticklabels=labels,<br>      vmin=0,<br>      vmax=1,<br>      cmap=&quot;YlOrRd&quot;)<br>  g.set_xticklabels(labels, rotation=rotation)<br>  g.set_title(&quot;Semantic Textual Similarity&quot;)<br><br>def run_and_plot(messages_):<br>  message_embeddings_ = model.encode(messages_)<br>  plot_similarity(messages_, message_embeddings_, 90)</pre><p>5. Moving back to the dataset. First, we are using sentence encoding model to be able to calculate similarities.</p><pre>encodings = []<br>for text in real[&#39;text&#39;]:<br>    encodings.append(model.encode(text))<br><br>real[&#39;encodings&#39;] = encodings</pre><p>6. Then, we can choose job posting we want to calculate similarities to. In our case it is the first job posting in the dataset, but you can easily change it to any other job posting by changing the value in the index variable.</p><pre>index = 0<br>corr = np.inner(encodings[index], encodings)<br>real[&#39;corr_to_first&#39;] = corr</pre><p>7. And based on the calculated similarities, we can show the top 5 most similar job postings, by sorting them according to calculated correlation value.</p><pre>real.sort_values(by=[&#39;corr_to_first&#39;], ascending=False).head()</pre><p>In this code sample, we explored and analyzed the dataset, then we pre-processed the data and created fake job postings detection model. At the end we used sentence similarities to show the top 5 recommendations — the most similar job descriptions to the chosen one.</p><h4>What’s Next?</h4><p>Leverage the most up-to-date Intel software and hardware optimizations for TensorFlow to accelerate AI workload performance, across not just recommender systems but also computer vision, natural language processing, and generative applications, on Intel hardware.</p><p>We encourage you to also check out and incorporate Intel’s other AI/ML Framework optimizations and tools into your AI workflow and learn about the unified, open, standards-based oneAPI programming model that forms the foundation of Intel’s AI Software Portfolio.</p><p><strong>First published location: </strong><a href="https://www.intel.com/content/www/us/en/developer/articles/technical/job-recommendation-system-with-tensorflow.html">https://www.intel.com/content/www/us/en/developer/articles/technical/job-recommendation-system-with-tensorflow.html</a></p><p><strong>First published date: </strong>02/18/2025</p><p><strong>Authors:</strong></p><p><em>Ramya Ravi, AI software marketing engineer</em></p><p><em>Urszula Zofia Gumińska, Development Tools software engineer</em></p><p><em>Chandan Damannagari, Director, AI Software</em></p><p><em>Intel Corporation</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce33f900c9bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimizing Genetic Algorithms in Python]]></title>
            <link>https://medium.com/@this.technology.life/optimizing-genetic-algorithms-in-python-3a00bd479633?source=rss-b12bf0083934------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a00bd479633</guid>
            <category><![CDATA[numpy]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[gpu]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[genetic-algorithm]]></category>
            <dc:creator><![CDATA[This Technology Life]]></dc:creator>
            <pubDate>Fri, 19 Sep 2025 18:02:20 GMT</pubDate>
            <atom:updated>2025-09-19T18:02:20.040Z</atom:updated>
            <content:encoded><![CDATA[<p>Genetic algorithms (GA) are computational techniques inspired by the process of natural selection to solve constrained and unconstrained optimization problems. These algorithms are usually applied to various optimization problems, which are NP-hard, where finding a solution by standard methods consumes time and resources. GAs are based on an analogy of biological evolution and how human chromosomes behave.</p><p>This article demonstrates a<a href="https://github.com/oneapi-src/oneAPI-samples/blob/master/AI-and-Analytics/Features-and-Functionality/IntelPython_GPU_numba-dpex_Genetic_Algorithm/IntelPython_GPU_numba-dpex_Genetic_Algorithm.ipynb"> code example </a>on how to implement a general GA and perform an offload computation to a GPU using numba-dpex for Intel Distribution for Python.</p><h3>Operations in Genetic Algorithms</h3><p>For GAs, it is possible to obtain a high-quality result based on three important biology-inspired operations: selection, crossover, and mutation. To apply GAs to a specific problem, it is important to define the representation of the chromosome and the GA operations.</p><h3>Selection</h3><p>This is the process of selecting a mate and recombining it to create offspring. Parent selection is crucial for the convergence rate of GA as good parents drive individuals to better and fitter solutions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/0*YWDND-YR5f53aF59.png" /><figcaption>Figure 1. An example of the selection process where half of the chromosomes are removed from the next generation.</figcaption></figure><p>The selection process usually requires some additional algorithms that will determine which chromosomes will become parents.</p><h3>Crossover</h3><p>This process is the same as biological crossover. Here, more than one parent is selected, and one or more offspring are produced using the parents’ genetic materials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/0*C40-i9u1Yg8pDqrH.png" /><figcaption>Figure 2. An example of a crossover operation.</figcaption></figure><p>The crossover operation creates child genomes from selected parent chromosomes, as shown in figure 2. It can be a one-point crossover and only one child genome is created. The first part of the child genome comes from the first parent and the second half from the second parent.</p><h3>Mutation</h3><p>A small, random tweak in the chromosome provides a new solution. It is used to maintain and introduce diversity in the genetic population and is usually applied with a low probability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/0*ZimgRGXl-zZ712YU.png" /><figcaption>Figure 3. An example of a mutation operation where one chromosome value is changed.</figcaption></figure><p>The mutation operation can change the chromosome as shown in figure 3.</p><h3>Optimize Genetic Algorithms with Intel Distribution for Python</h3><p>Intel Distribution for Python helps developers achieve near-native code performance using libraries like Intel oneAPI Math Kernel Library (oneMKL) and Intel oneAPI Data Analytics Library (oneDAL) . Researchers and developers can scale compute-intensive Python code from laptops to powerful servers using optimized NumPy, SciPy, and Numba.<br>To optimize the genetic algorithm with Intel Distribution of Python, use Data Parallel Extension for Numba ( numba-dpex ) range kernel. This kernel represents the simplest form of parallelism and data-parallel running over a set of work items with each work item representing a logical thread of running.</p><p>Let’s look at the example implementation of the kernel for a vector-add operation:</p><pre>import dpnp<br>import numba_dpex<br><br>@numba_dpex.kernel<br>def vector_add(item: numba_dpex.kernel_api.Item, a, b, c):<br>    i = item.get_id(0)<br>    c[i] = a[i] + b[i]</pre><p>To run this code, create all three vectors, a, b and c, where a and b are filled with the data, and c stores the result of the operation. Then, you need to send the vectors to a specific device, like a GPU, and then run the kernel as follows:</p><pre>N = 1024<br>a = dpnp.ones(N, device=&quot;gpu&quot;)<br>b = dpnp.ones_like(a, device=&quot;gpu&quot;)<br>c = dpnp.zeros_like(a, device=&quot;gpu&quot;)<br> <br>numba_dpex.call_kernel(vector_add, numba_dpex.kernel_api.Range(N), a, b, c)</pre><p>In the previous code, the vector-add operation was run on a GPU and the result was stored in vector c. Similarly, for any other function or any other algorithm, the implementation looks the same.</p><h3>Code Implementation</h3><p>To create the general GA and optimize the algorithm to run on GPUs using the numba-dpex for Intel Distribution for Python, see the code example . It also explains how to implement different operations of GA such as selection, crossover, and mutation and how to adjust these methods to other optimization problems.</p><p>1. Set up the environment and import the libraries:</p><pre>import numpy as np <br>import time <br>import random <br>import math</pre><p>2. Initialize the population by setting the following:</p><ul><li>Population: 5,000</li><li>Chromosome size: 10</li><li>Generations: 5.</li></ul><p>Each chromosome contains 10 random floats between 0 and 1. To reproduce the results later, set the seed as follows:</p><pre>random.seed(1111)<br><br>pop_size = 5000<br>chrom_size = 10<br>num_generations = 5<br><br>fitnesses = np.zeros(pop_size, dtype=np.float32)<br>chromosomes = np.zeros(shape=(pop_size, chrom_size), dtype = np.float32)<br>for i in range(pop_size):<br>  for j in range(chrom_size):<br>    chromosomes[i][j] = random.uniform(0,1)</pre><p>3. Implement the GA by creating an evaluation method. This function is the baseline and comparison for numba-dpex . Here, the fitness of an individual is computed by an arbitrary set of algebraic operations on the chromosome.</p><pre>def eval_genomes_plain(chromosomes, fitnesses):<br>  for i in range(len(chromosomes)):<br>    num_loops = 3000<br>    for j in range(num_loops):<br>      fitnesses[i] += chromosomes[i][1]<br>    for j in range(num_loops):<br>      fitnesses[i] -= chromosomes[i][2]<br>    for j in range(num_loops):<br>      fitnesses[i] += chromosomes[i][3]<br><br>    if (fitnesses[i] &lt; 0):<br>      fitnesses[i] = 0</pre><p>4. Implement the crossover operation: The inputs have two different chromosomes as the first and second parent. The output of the function returns one new chromosome.</p><pre>def crossover(first, second):<br>  index = random.randint(0, len(first) - 1)<br>  index2 = random.randint(0, len(second) - 1)<br><br>  child_sequence = []<br><br>  for y in range(math.floor(len(first) / 2)):<br>      child_sequence.append( first[ (index + y) % len(first) ] )<br><br>  for y in range(math.floor(len(second)/ 2)):<br>      child_sequence.append( second[ (index2 + y) % len(second) ] )<br>      <br>  return child_sequence</pre><p>5. Implement the mutation operation: This code example has a one percent chance to change every float in the chromosome to a different random number.</p><pre>def mutation(child_sequence, chance=0.01):<br>  child_genome = np.zeros(len(child_sequence), dtype=np.float32)<br><br>  # Mutation<br>  for a in range(len(child_sequence)):<br>    if random.uniform(0,1) &lt; chance:<br>      child_genome[a] = random.uniform(0,1)<br>    else:<br>      child_genome[a] = child_sequence[a]<br><br>  return child_genome</pre><p>6. Implement the selection operation, which is the base for creating a new generation. Within this function, a new population is created after crossover and mutation operations.</p><pre>def next_generation(chromosomes, fitnesses):<br>  fitness_pairs = []<br>  fitnessTotal = 0.0<br>  for i in range(len(chromosomes)):<br>    fitness_pairs.append( [chromosomes[i], fitnesses[i]] )<br>    fitnessTotal += fitnesses[i]<br><br>  # Sort fitness in descending order<br>  fitnesses = list(reversed(sorted(fitnesses)))<br>  sorted_pairs = list(reversed(sorted(fitness_pairs, key=lambda x: x[1])))<br><br>  new_chromosomes = np.zeros(shape=(pop_size, chrom_size), dtype = np.float32)<br><br>  # Roulette wheel<br>  rouletteWheel = []<br>  fitnessProportions = []<br>  for i in range(len(chromosomes)):<br>      fitnessProportions.append( float( fitnesses[i]/fitnessTotal ) )<br>      if(i == 0):<br>          rouletteWheel.append(fitnessProportions[i])<br>      else:<br>          rouletteWheel.append(rouletteWheel[i - 1] + fitnessProportions[i])<br><br>  # New population<br>  for i in range(len(chromosomes)):<br><br>      # Selection<br>      spin1 = random.uniform(0, 1)<br>      spin2 = random.uniform(0, 1)<br><br>      j = 0<br>      while( rouletteWheel[j] &lt;= spin1 ):<br>          j += 1<br><br>      k = 0<br>      while( rouletteWheel[k] &lt;= spin2 ):<br>          k += 1<br><br>      parentFirst = sorted_pairs[j][0]<br>      parentSecond = sorted_pairs[k][0]<br><br>      # Crossover    <br>      child_sequence = crossover(parentFirst, parentSecond)<br><br>      # Mutation<br>      child_genome = mutation(child_sequence)<br>      <br>      # Add new chromosome to next population<br>      new_chromosomes[i] = child_genome<br><br>  return new_chromosomes</pre><p>7. Run the prepared functions, starting with a baseline on a CPU. As the first population is initialized, each generation contains the following steps:</p><p>(a ) Evaluation of the current population using the <strong>eval_genomes_plain</strong> function</p><p>(b ) Create the next generation using a <strong>next_generation</strong> function</p><p>(c ) Wipe fitnesses values, since the new generation was already created</p><p>The computation time for those operations is measured and printed. The first chromosome is also printed to show that the computations were the same on both CPU and GPU.</p><pre>print(&quot;CPU:&quot;)<br>start = time.time()<br><br># Genetic Algorithm on CPU<br>for i in range(num_generations):<br>  print(&quot;Gen &quot; + str(i+1) + &quot;/&quot; + str(num_generations))<br>  eval_genomes_plain(chromosomes, fitnesses)<br>  chromosomes = next_generation(chromosomes, fitnesses) <br>  fitnesses = np.zeros(pop_size, dtype=np.float32)<br>end = time.time()<br><br>time_cpu = end-start<br>print(&quot;time elapsed: &quot; + str((time_cpu)))<br>print(&quot;First chromosome: &quot; + str(chromosomes[0]))</pre><p>8. Run on a GPU: Start with a new population initialization (the same as step 2), and then implement an evaluation function for the GPU. The only difference between GPU and CPU implementation is that on GPUs you use a flatten data structure for chromosomes. Also, instead of having to loop over all the chromosomes, use kernels from numba-dpex and a global index.</p><pre>import numba_dpex<br>from numba_dpex import kernel_api<br><br>@numba_dpex.kernel<br>def eval_genomes_sycl_kernel(item: kernel_api.Item, chromosomes, fitnesses, chrom_length):<br>  pos = item.get_id(0)<br>  num_loops = 3000<br>  for i in range(num_loops):<br>    fitnesses[pos] += chromosomes[pos*chrom_length + 1]<br>  for i in range(num_loops):<br>    fitnesses[pos] -= chromosomes[pos*chrom_length + 2]<br>  for i in range(num_loops):<br>    fitnesses[pos] += chromosomes[pos*chrom_length + 3]<br><br>  if (fitnesses[pos] &lt; 0):<br>    fitnesses[pos] = 0</pre><p>9. Similar to the CPU, the time for evaluation, creation of a new generation, and a fitness wipe is measured while a GPU is running. Send all the chromosomes and the fitness container to the chosen device. Then you can run a kernel with a defined range.</p><pre>import dpnp<br><br>print(&quot;SYCL:&quot;)<br>start = time.time()<br><br># Genetic Algorithm on GPU<br>for i in range(num_generations):<br>  print(&quot;Gen &quot; + str(i+1) + &quot;/&quot; + str(num_generations))<br>  chromosomes_flat = chromosomes.flatten()<br>  chromosomes_flat_dpctl = dpnp.asarray(chromosomes_flat, device=&quot;gpu&quot;)<br>  fitnesses_dpctl = dpnp.asarray(fitnesses, device=&quot;gpu&quot;)<br>  exec_range = kernel_api.Range(pop_size)<br>  numba_dpex.call_kernel(eval_genomes_sycl_kernel, exec_range, chromosomes_flat_dpctl, fitnesses_dpctl, chrom_size)<br>  fitnesses = dpnp.asnumpy(fitnesses_dpctl)<br>  chromosomes = next_generation(chromosomes, fitnesses)<br>  fitnesses = np.zeros(pop_size, dtype=np.float32)<br><br>end = time.time()<br>time_sycl = end-start<br>print(&quot;time elapsed: &quot; + str(time_sycl))<br>print(&quot;First chromosome: &quot; + str(chromosomes[0]))</pre><p>Apply the same steps on other optimization problems. Define the chromosome, selection, crossover, mutation, and evaluation operations. The rest of running the algorithm is the same.</p><p>Run the previous code example and compare the performance of this algorithm while performing sequential running on a CPU and parallel running on a GPU. The code output illustrates that the performance speed increases using a numba-dpex parallel implementation that runs on a GPU.</p><h3>Next Steps</h3><ul><li>Incorporate Intel Distribution for Python into your workflow and accelerate performance with optimizations for NumPy, SciPy, and Numba that scale from laptops up to powerful servers.</li><li>Feel free to contribute to the Intel Distribution for Python project on GitHub</li></ul><p><strong>First published location: </strong><a href="https://www.intel.com/content/www/us/en/developer/articles/technical/optimize-genetic-algorithms-python.html">https://www.intel.com/content/www/us/en/developer/articles/technical/optimize-genetic-algorithms-python.html</a></p><p><strong>First published date: </strong>10/03/2024</p><p><strong>Authors:</strong></p><p><em>Ramya Ravi, AI software marketing engineer</em></p><p><em>Urszula Zofia Gumińska, Development Tools software engineer</em></p><p><em>Chandan Damannagari, Director, AI Software</em></p><p><em>Intel Corporation</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a00bd479633" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimize Stable Diffusion Upscaling with Diffusers and PyTorch]]></title>
            <link>https://medium.com/@this.technology.life/optimize-stable-diffusion-upscaling-with-diffusers-and-pytorch-d8fd136a4132?source=rss-b12bf0083934------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8fd136a4132</guid>
            <category><![CDATA[image-upscaling]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[hugging-face]]></category>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[stable-diffusion]]></category>
            <dc:creator><![CDATA[This Technology Life]]></dc:creator>
            <pubDate>Thu, 18 Sep 2025 16:47:45 GMT</pubDate>
            <atom:updated>2025-09-18T16:47:45.677Z</atom:updated>
            <content:encoded><![CDATA[<p>Stable Diffusion is a model for generating high-quality images from textual descriptions, leveraging the power of latent diffusion models. The Hugging Face diffusers library provides easy-to-use pipelines to deploy and utilize the Stable Diffusion model, including generating, modifying, and upscaling images.</p><p>In this article, we will delve into the process of upscaling images generated by Stable Diffusion using the <strong>StableDiffusionUpscalePipeline</strong> from the diffusers library. We will discuss the reasons behind upscaling and demonstrate how to optimize this process for better performance on Intel Xeon Processors using Intel Extension for PyTorch (a Python package where Intel releases its newest optimizations and features before upstreaming them into open source PyTorch).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*-pTQDEN-xGL-YzSnwlnD1A.png" /></figure><h3>What is Upscaling?</h3><p>Stable Diffusion models usually generates images at a lower resolution to save on computational resources. However, for many applications, higher resolution images are necessary. This is where upscaling comes into play. It is the process of increasing the resolution of an image while attempting to maintain, or even enhance, the quality of the original image.</p><h3>Optimize the StableDiffusionUpscalePipeline for Inference</h3><p>The <strong>StableDiffusionUpscalePipeline</strong> from the Hugging Face diffusers library is designed to enhance the resolution of input images using the Stable Diffusion model, particularly increasing the resolution by a factor of four. This pipeline utilizes a combination of components including a Variational Auto-Encoder (VAE) for encoding and decoding images, a frozen CLIP text model for text encoding, a UNet architecture for denoising image latents, and various schedulers to manage the diffusion process during image generation.</p><p>This pipeline is particularly useful for applications requiring high-resolution image outputs from lower resolution inputs, making it ideal for enhancing details in generated or real-world images. It allows users to specify various parameters such as the number of denoising steps, the guidance scale to balance fidelity to the input text against image quality, and even supports custom callbacks during the inference process to monitor or modify the generation.</p><p>For detailed examples of how to use this pipeline and configure its parameters for optimal results, check out the Hugging Face documentation and model hub.</p><p>Additionally, to boost the performance of the StableDiffusionUpscalePipeline, we can optimize its components individually before combining them. Intel Extension for PyTorch, plays a crucial role in this optimization. The extension enhances PyTorch with advanced optimizations for an additional performance increase on Intel hardware. These enhancements utilize the capabilities of Intel Advanced Vector Extensions 512 (Intel AVX-512), Vector Neural Network Instructions (VNNI), and Intel Advanced Matrix Extensions (Intel AMX) within Intel CPUs. Intel Extension for PyTorch introduces an accessible Python API — `ipex.optimize()` which automatically optimizes the pipeline module, allowing it to leverage these sophisticated hardware instructions for greater performance efficiency.</p><h3>Code Sample</h3><p>The code snippet below demonstrates how to upscale an image using the Stable Diffusion Upscale Pipeline from the diffusers library, with optimizations for performance using Intel Extension for PyTorch. U-Net, VAE, and text encoder components of the pipeline are targeted separately and optimized for CPU inference.</p><p><strong>1. Setting Up the Environment</strong></p><p>It is recommended to create a Conda virtual environment to perform the installations. Install PyTorch, diffusers and Intel Extension for PyTorch:</p><pre>python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu<br>python -m pip install intel-extension-for-pytorch<br>python -m pip install oneccl_bind_pt --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/cpu/us/<br>pip install transformers<br>pip install diffusers</pre><p><strong>2. Steps to Optimize</strong></p><p>First, let’s import all the necessary packages including Intel Extension for PyTorch and load the sample image that we wish to upscale:</p><pre>from diffusers import StableDiffusionUpscalePipeline <br>import torch <br>from PIL import Image <br><br>###########################################<br>import intel_extension_for_pytorch as ipex <br>########################################### <br><br># Load an image from the filesystem <br><br>img = Image.open(&quot;./sample.png&quot;)</pre><p>Next, let’s look at how the upscaling pipeline can be optimized using features from Intel Extension for PyTorch.</p><pre># Initialize the upscaling pipeline with a pre-trained model <br>pipeline = StableDiffusionUpscalePipeline.from_pretrained(&quot;stabilityai/stable-diffusion-x4-upscaler&quot;) <br>prompt = &quot;HD, 4k, hyper realistic, extremely detailed, professional, vibrant, not grainy, smooth&quot; <br> <br># Convert model to channels last format for performance optimization <br>pipeline.unet = pipeline.unet.to(memory_format=torch.channels_last) <br>pipeline.vae = pipeline.vae.to(memory_format=torch.channels_last) <br>pipeline.text_encoder = pipeline.text_encoder.to(memory_format=torch.channels_last) <br> <br># Optimize the model components with IPEX for better CPU performance <br>pipeline.unet = ipex.optimize(pipeline.unet.eval(), dtype=torch.bfloat16, inplace=True) <br>pipeline.vae = ipex.optimize(pipeline.vae.eval(), dtype=torch.bfloat16, inplace=True) <br>pipeline.text_encoder = ipex.optimize(pipeline.text_encoder.eval(), dtype=torch.bfloat16, inplace=True)</pre><p>Each component of the pipeline is targeted separately to be optimized. First, we set the UNet, VAE and the text encoder to Channels Last format. Using channels last format orders tensor dimensions as batch, height, width, and channels. This arrangement is more efficient as it aligns better with certain memory access patterns, leading to performance improvements. Channels last is particularly advantageous in reducing the need for data reordering during operations, which can significantly boost processing speed for convolutional neural networks.</p><p>Similarly, each component is optimized by Intel Extension for PyTorch using `ipex.optimize()` with the data type set to BFloat16. Operations running on BFloat16 precision are optimized using Intel AMX, available on 4th Gen Xeon Scalable Processors and above. Intel AMX is a built-in AI accelerator for lower precision data types such as BFloat16 and INT8 and can be enabled by using IPEX’s `optimize()` function.</p><pre># Perform the upscaling with autocasting for mixed precision <br>with torch.cpu.amp.autocast(): <br>    upscaled_image = pipeline(prompt=prompt, image=img, num_inference_steps=20, guidance_scale=0, generator=torch.manual_seed(33)).images[0] <br> <br># Save the upscaled image with a unique timestamped filename <br>filename = &#39;upscaled_img.png&#39; <br>upscaled_image.save(filename)</pre><p>Finally, we can perform the upscaling optimally by using mixed precision which combines the computational speed and memory savings of lower precision arithmetic (like BF16) with the numerical stability of higher precision (like FP32). Setting `torch.cpu.amp.autocast()` automatically applies mixed precision to our pipeline. The resulting pipeline object is now optimized with Intel Extension for PyTorch and can be used to upscale images while also achieving low latency.</p><p><strong>3. Advanced Environment Setup</strong></p><p>This section shows how you can get additional performance boost by setting environment variables and configurations optimized for performance on Intel Xeon processors, especially for parallel computing and optimized memory management. The script <em>‘</em>env_activate.sh<em>’ </em>sets a series of environment variables that are specific to the Intel OpenMP library. It also uses LD_PRELOAD to specify which shared libraries are loaded before others. The script dynamically builds the path to certain libraries, ensuring they are loaded at runtime before the application starts.</p><p>Steps to set up Advanced Environment for high performance on Intel Xeon processors:</p><pre># Install two packages that serve as dependencies to use the script<br>pip install intel-openmp<br>conda install -y gperftools -c conda-forge<br><br>git clone https://github.com/intel/intel-extension-for-pytorch.git<br>cd intel-extension-for-pytorch<br>git checkout v2.3.100+cpu<br><br>cd examples/cpu/inference/python/llm<br><br># Activate environment variables<br>source ./tools/env_activate.sh<br># Run a script with the code from the previous section<br>python run_upscaler_pipeline.py</pre><p>After running the above steps, your environment is ready to run StableDiffusionUpscalePipeline that was optimized in the previous section for higher performance by setting performance flags. Additionally, inference using the Intel Extension for Pytorch optimized pipeline can provide extra performance.</p><h3>Next Steps</h3><p>Leverage the optimizations from Intel Extension for PyTorch and utilize the full capabilities of Intel’s hardware innovations to enhance the performance of your AI applications. Download and try the AI Tools and Intel Extension for PyTorch for yourself to build various end-to-end AI applications.</p><p>We encourage you to also check out and incorporate Intel’s other AI/ML Framework optimizations and tools into your AI workflow. For more details about 4th Gen Intel Xeon Scalable processors, visit Intel’s AI Solution Platform portal where you can learn how Intel is empowering developers to run end-to-end AI pipelines on these powerful CPUs.</p><p><strong>First published location: </strong><a href="https://www.intel.com/content/www/us/en/developer/articles/technical/optimize-stable-diffusion-upscaling-with-pytorch.html">https://www.intel.com/content/www/us/en/developer/articles/technical/optimize-stable-diffusion-upscaling-with-pytorch.html</a></p><p><strong>First published date: </strong>09/12/2024</p><p><strong>Authors:</strong></p><p><em>Ramya Ravi, AI software marketing engineer</em></p><p><em>Pramod Pai, AI software solutions engineer</em></p><p><em>Chandan Damannagari, Director, AI Software</em></p><p><em>Intel Corporation</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8fd136a4132" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A hands-on guide to quantizing Large Language Models (LLMs)]]></title>
            <link>https://medium.com/@this.technology.life/a-hands-on-guide-to-quantizing-large-language-models-llms-13b21cc5a16e?source=rss-b12bf0083934------2</link>
            <guid isPermaLink="false">https://medium.com/p/13b21cc5a16e</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[quantization]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[gguf]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[This Technology Life]]></dc:creator>
            <pubDate>Wed, 17 Sep 2025 15:31:45 GMT</pubDate>
            <atom:updated>2025-09-17T19:49:02.260Z</atom:updated>
            <content:encoded><![CDATA[<p>In recent years, the complexity, capabilities, and applications of large language models (LLMs) have continued to increase. As LLMs have grown in complexity and intelligence, so has their size with the number of parameters, weights and activations continuing to rise. However, increasing the number of potential deployment targets and reducing inference costs typically require us to compress LLMs while not materially compromising their performance. There are various techniques to decrease the size of large neural networks, including large language models — one such important technique is quantization.</p><p>In this article, we present a <a href="https://github.com/oneapi-src/oneAPI-samples/blob/master/AI-and-Analytics/Features-and-Functionality/IntelTransformers_Quantization/quantize_transformer_models_with_itrex.ipynb">code sample</a> on how to perform (INT8 and INT4) quantization on an LLM (Intel/neural-chat-7b model) with Weight Only Quantization (WOQ) technique (using the Intel Extension for Transformers tool).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*vUttDgH4jrmR707gfexSpQ.png" /></figure><h3>What is Quantization?</h3><p>Quantization is the process of going from using high-precision representation (like float32) for weights and/or activations to lower precision data types like float16, INT8 or INT4. Using lower precision can significantly reduce the memory requirement. In theory, this might look straightforward but there are many nuances that one needs to be aware of and the most important caveat to understand would be to compute data type. Not all operations support or have low-precision implementation, and we must scale the representation back to high precision at runtime to perform certain operations. This adds some extra overhead, but we can make use of tools such as Intel Neural Compressor, OpenVINO toolkit and Neural Speed to reduce its impact. These runtimes have optimized implementations of various operators for low-precision data types, as a result, it is not required to upscale the values to high-precision leading to better performance while using less memory. The performance gains are significant if your hardware supports lower-precision data types. For example, 4th Gen Intel Xeon Scalable processors have built-in support for float16 and bfloat16.</p><p>Thus, quantization is only used to reduce the memory footprint of the model, but it can add some overhead during inference. To get performance benefits, along with memory benefits, one must use the latest hardware and make use of optimized runtimes.</p><h3>Weight Only Quantization (WOQ)</h3><p>There are several techniques for quantizing models. Generally, both model weights and activations (output values generated by each neuron in a layer) are quantized. However, one of these quantization techniques is Weight Only Quantization, which only quantizes the model weights, and the activations remain in their original precision. The obvious benefits are smaller memory footprint and faster inference. In practice, WOQ yields performance benefits without significantly impacting accuracy.</p><h3>Code Implementation</h3><p>The code sample illustrates the process of quantizing the Intel/neural-chat-7b-v3–3 language model. This model is a fine-tuned iteration of Mistral-7B, undergoes quantization utilizing Weight Only Quantization (WOQ) techniques provided by Intel Extension for Transformers.</p><ol><li>It is easy for developers to unleash the power of Intel hardware for their Generative AI workloads with just one line of code change. Instead of importing AutoModelForCausualLM from Hugging Face transformers library, you import it from Intel Extension for Transformers and everything else remains as is.</li></ol><pre>from intel_extension_for_transformers.transformers import AutoModelForCausalLM</pre><p>2. For INT8 quantization, just set load_in_8bit to True.</p><pre># INT8 quantization<br>Q8_model = AutoModelForCausalLM.from_pretrained(<br>    model_name, load_in_8bit=True)</pre><p>3. Similarly, for INT4 quantization set load_in_4bit to True.</p><pre># INT4 quantization<br>q4_model = AutoModelForCausalLM.from_pretrained(<br>    model_name, load_in_4bit=True)</pre><p>The implementation is the same as employing Hugging Face transformers library.</p><p>The above code snippets will use BitandBytes for quantization if you set device to GPU. This helps your code run extremely fast whether you are using a CPU or GPU without any code change.</p><h3>Running GGUF model</h3><p>GGUF is a binary file format designed specifically for storing deep learning models, such as LLMs, particularly for inference on CPUs. It offers several key advantages, including efficiency, single-file deployment, and quantization. To make the most of our Intel hardware, we will be using the model in GGUF format.</p><p>Generally, to run models in GGUF format, one would need to use an additional library like Llama_cpp. However, since Neural Speed is built on top of Llama_cpp, you can continue using our Intel Extension for Transformers library to run GGUF models as well.</p><pre>model = AutoModelForCausalLM.from_pretrained(<br>      model_name=“TheBloke/Llama-2-7B-Chat-GGUF”, <br>      model_file=“llama-2-7b-chat.Q4_0.gguf”)</pre><p>Try out the code sample for yourself. It shows how to quantize an LLM model using Intel’s AI Tools, Intel Extension for Transformers and how to make the most out of your Intel hardware when developing Generative AI based applications.</p><h3>What’s Next?</h3><p>We encourage you to also check out and incorporate Intel’s other AI/ML Framework optimizations into your AI workflow and learn about the unified, open, standards-based oneAPI programming model that forms the foundation of Intel’s AI Software Portfolio to help you prepare, build, deploy, and scale your AI solutions.</p><p><strong>First published location: </strong><a href="https://www.intel.com/content/www/us/en/developer/articles/technical/hands-on-guide-to-quantizing-llms.html">https://www.intel.com/content/www/us/en/developer/articles/technical/hands-on-guide-to-quantizing-llms.html</a></p><p><strong>First published date: </strong>08/30/2024</p><p><strong>Authors:</strong></p><p><em>Ramya Ravi, AI software marketing engineer</em></p><p><em>Ankur Singh, Code Samples Software Engineer</em></p><p><em>Chandan Damannagari, Director, AI Software</em></p><p><em>Intel Corporation</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=13b21cc5a16e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enhance AI Upscaling with Intel AI Neural Processing Unit (NPU)]]></title>
            <link>https://medium.com/@this.technology.life/enhance-ai-upscaling-with-intel-ai-neural-processing-unit-npu-178f4d32d4c7?source=rss-b12bf0083934------2</link>
            <guid isPermaLink="false">https://medium.com/p/178f4d32d4c7</guid>
            <category><![CDATA[super-resolution]]></category>
            <category><![CDATA[image-upscaling]]></category>
            <category><![CDATA[npu]]></category>
            <category><![CDATA[ai-hardware]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[This Technology Life]]></dc:creator>
            <pubDate>Tue, 16 Sep 2025 14:17:42 GMT</pubDate>
            <atom:updated>2025-09-16T14:17:42.364Z</atom:updated>
            <content:encoded><![CDATA[<p>AI Upscaling, also referred to as, Image Upscaling or Super-Resolution is a technique that takes an input image and then upscales the resolution of the input image using Deep Neural Networks. One of the most common applications of AI Upscaling is to restore photos and videos from the 1990s or 2000s recorded in lower resolutions. AI Upscaling can convert images that are 360p resolution or lower to 1080p and even 4k resolution with minimal quality loss.</p><p>In this article, we will demonstrate how to run a popular AI Upscaling model on Intel’s AI Boost Neural Processing Unit (NPU) provided in the Intel AI PC (powered by Intel Core Ultra processor). Intel Core Ultra processor accelerates AI on the PC by combining CPU, GPU, and NPU via a 3D performance hybrid architecture, together with high-bandwidth memory and cache. We will use the Intel Distribution of OpenVINO toolkit and the Neural Network Compression Framework (NNCF) for weight compression, allowing our AI Upscaling model to run performantly on the Intel AI PC.</p><h3>Get Started</h3><h4>AI Upscaling Model</h4><p>The AI Upscaling model that will be used is the BSRGAN (Blind Super-Resolution Generative Adversarial Network). BSRGAN retains the same architecture as ESRGAN (Enhanced Super-Resolution Generative Adversarial Network. Both BSRGAN and ESRGAN use a Generative Adversarial Network structure (GAN) to allow the generator to create more representative upscaled images that align with the ground truth. BSRGAN, unlike ESRGAN, is trained on synthetic images that can represent diverse degradation of images, or in other words, reasons why lower resolution images are often lower quality (noise, blurring, etc.). This allows BSRGAN to generalize more to real-world use cases where different degradations happen.</p><h4>OpenVINO toolkit and NNCF</h4><p>OpenVINO is an open-source deep learning toolkit that allows users to easily deploy and accelerate deep learning models with hardware optimizations. OpenVINO can convert PyTorch, TensorFlow Models, ONNX models, and more into OpenVINO’s Intermediate Representation (IR) format. OpenVINO then uses this IR as well as the available hardware accelerators to efficiently run deep learning inference.</p><p>The Neural Network Compression Framework (NNCF) is a deep learning framework that allows users to easily apply post-training and training-aware deep learning compression algorithms (e.g. quantization techniques) to their deep learning models. It supports OpenVINO models, PyTorch models, and more model formats.</p><h4>AI PC</h4><p>AI PCs represent the new generation of personal computers to provide power efficient AI acceleration and handle AI tasks locally which includes a central processing unit (CPU), a graphic processing unit (GPU), and a neural processing unit (NPU). AI PCs powered by Intel Core Ultra processors can balance power and performance for fast and efficient AI experiences. NPUs are specialized hardware designed for AI capabilities and allow the AI PC to perform a variety of AI tasks efficiently.</p><h3>Code Sample</h3><p>This <a href="https://github.com/intel/AI-PC_Notebooks/blob/main/AI-Upscaling-With-NPU/AI_Upscaling_With_NPU.ipynb">code sample</a> is available in the AI PC Notebooks GitHub Repository. Here, BSRGAN model is used to AI-upscale an image and video optimized for Intel’s AI Boost NPU using OpenVINO and NNCF.</p><p>The following steps are implemented in the code sample:</p><ol><li><strong>Convert PyTorch model to OpenVINO model: </strong>After loading in the BSRGAN model, we can then convert the model to the OpenVINO format. Currently, OpenVINO only supports static shapes for the NPU, which is why we need to provide an explicit input shape for the BSRGAN model. With future updates, OpenVINO will support dynamic shapes for the NPU.</li></ol><pre>ov_model = ov.convert_model(<br>    cpu_model,<br>    input=[1, 3, width, height],<br>    example_input=torch.randn(1, 3, width, height),<br>)</pre><p><strong>2. Compress model weights: </strong>The NNCF framework is used to run data-free 4-bit symmetric quantization on the BSRGAN model. This data-free quantization takes the 32-bit floating point weights and maps them into a 4-bit range while still allowing for a fixed zero-point.</p><pre>compressed_model = compress_weights(ov_model, mode=CompressWeightsMode.INT4_SYM)</pre><p><strong>3. Compile OpenVINO model:</strong> Run the OpenVINO compilation on NPU.</p><pre>core = ov.Core()<br>compiled_model = core.compile_model(compressed_model, device_name=&quot;NPU&quot;)</pre><p><strong>4. Visualize Upscaled Image: </strong>The code sample will create an interactive visualization using Plotly displaying the original image and the AI-upscaled image from the CPU and NPU.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/0*jlrajVi6Dqd6zBb1.png" /></figure><p><strong>5. Visualize performance between CPU and NPU:</strong> The code sample will create an interactive visualization using Plotly displaying the performance gains the NPU achieves over the CPU.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/0*Ij1Eyslg8q-tCgv_.png" /></figure><p><strong>6. Run AI Upscaling model on video: </strong>Using OpenVINO’s asynchronous inference queue, we can run the AI Upscaling model performantly on a video. This runs at around 5 frames processed per second.</p><pre>def callback(infer_request, userdata):<br>    res = infer_request.get_output_tensor(0).data[0]<br>    frame = postprocess(res)<br><br>    pbar, postprocessed_frames = userdata<br>    pbar.update(1)<br>    postprocessed_frames.append(frame)<br><br>infer_queue = ov.AsyncInferQueue(compiled_model)<br>infer_queue.set_callback(callback)<br>pbar = tqdm(total=len(original_frames), desc=&quot;Inferencing frames&quot;)<br><br>postprocessed_frames = []<br>for frame in original_frames:<br>    new_frame = preprocess(frame)<br>    infer_queue.start_async(<br>        inputs={input_layer.any_name: new_frame}, userdata=(pbar, postprocessed_frames)<br>    )<br><br>infer_queue.wait_all()</pre><p>Try out the above code sample for yourself. The code sample output illustrates the difference between original and upscaled images and videos and also shows the performance improvement while running the model on the NPU compared to CPU.</p><h3>What’s Next</h3><p>Many AI Upscaling technologies have often only been able to run performantly on discrete GPUs. However, with the new AI PC, AI Upscaling is now able to run performantly on everyday laptops with the help of the Intel AI Boost NPU. Additionally, elevate your speed, efficiency, privacy, and security for various AI tasks such as creating creative content, drafting emails, improve reporting, manage schedules and auto-summarization of meetings with detailed notes on Intel AI PCs.</p><p>We encourage you to also check out and incorporate Intel’s other AI/ML Framework optimizations and tools into your AI workflow and learn about the unified, open, standards-based oneAPI programming model that forms the foundation of Intel’s AI Software Portfolio to help you prepare, build, deploy, and scale your AI solutions.</p><p><strong>First published location: </strong><a href="https://www.intel.com/content/www/us/en/developer/articles/technical/enhance-ai-upscaling-with-intel-ai-boost-npu.html">https://www.intel.com/content/www/us/en/developer/articles/technical/enhance-ai-upscaling-with-intel-ai-boost-npu.html</a></p><p><strong>First published date: </strong>01/22/2025</p><p><strong>Authors:</strong></p><p><em>Ramya Ravi, AI software marketing engineer</em></p><p><em>Gururaj Deshpande, Graduate Intern Technical</em></p><p><em>Chandan Damannagari, Director, AI Software</em></p><p><em>Intel Corporation</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=178f4d32d4c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Intel AI Solutions Accelerate Qwen3 Large Language Models]]></title>
            <link>https://medium.com/@this.technology.life/intel-ai-solutions-accelerate-qwen3-large-language-models-03b0ca17ddb4?source=rss-b12bf0083934------2</link>
            <guid isPermaLink="false">https://medium.com/p/03b0ca17ddb4</guid>
            <category><![CDATA[qwen-3]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[small-language-model]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[This Technology Life]]></dc:creator>
            <pubDate>Tue, 16 Sep 2025 01:01:47 GMT</pubDate>
            <atom:updated>2025-09-16T01:01:47.520Z</atom:updated>
            <content:encoded><![CDATA[<p>Intel continues to enable support and optimize performance for open-source models to accelerate AI solutions across datacenter, client, and edge environments. Following up on the recent release of Qwen3, the latest addition to the Qwen family of large language models (LLMs), we are thrilled to share our initial performance benchmarking results and use case demos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*ZU1ko7h1UQGsAVXciLAcDA.png" /></figure><p>Qwen3 launched a family of LLMs ranging in models from 0.6B to 235B parameters, two of which are Mixture-of-Experts (MoE) models — Qwen3–30B-A3B and Qwen3–235B-A22B. MoE models are gaining in popularity — they break down tasks into subtasks and then delegate subtasks to smaller, specialized “expert” models. MoE models like Qwen3–30B-A3B are computationally more efficient to process vs. traditional (“dense”) models. In addition, Qwen3 deploys a dual-mode system, allowing users to toggle between depth/complexity (“thinking mode”) and speed/responsiveness (“non-thinking mode”), depending on the task. The models also feature increased multilingual support and agentic abilities that integrate with external tools.</p><p>Intel is excited to support Qwen3 models running across our many product lines.</p><h3>AI PCs</h3><p>PCs and Edge devices are at the forefront of delivering AI experiences designed to assist users while remaining personalized and private. Intel enables AI language models to run locally on AI PCs powered by Intel Core Ultra processors that feature a neural processing unit (NPU) with a built-in Intel Arc GPU, or on Intel Arc discrete GPUs with Intel Xᵉ Matrix Extensions (XMX) AI acceleration. The Qwen3 release includes models that are ideal for on-device inference including highly efficient reasoning on the Qwen3–30B-A3B MoE model. For example, we ran this MoE model on an Intel Core Ultra 9 285H processor with a built-in Intel Arc GPU and saw a throughput of 34 tokens per second.</p><p>Along with the MoE models, Qwen3 has launched six dense models, including Qwen3–8B. You can see below the results of Qwen3–8B running across our Intel Arc GPUs in two configurations: (1) built-in Intel Arc GPU in our Intel Core Ultra 7 258V processor, and (2) a discrete Intel Arc B580 desktop graphics card:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1BazcIwJn_TUWKeO.jpg" /></figure><p>Through our extensive ecosystem and enablement, Intel is also the only company to support Qwen3 language models running on the NPU, at launch, also commonly referred to as providing Day 0 support. Intel has a long history of supporting the open-source ecosystem, providing more diverse and targeted platform support for different models and application scenarios. Below you can see several Qwen3 LLMs running on the NPU of the Intel Core Ultra 7 258V processor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LSJLFQyZmXulC3tE.jpg" /></figure><p>Smaller LLMs offer the advantage of flexible, efficient lightweight deployment, supporting quicker iterations and model updates. However, smaller LLMs trade-off depth and breadth of their knowledge while handling complex tasks. By fine-tuning these small LLMs with the help of specific datasets, end-users can improve model intelligence and optimize their user experience. To this end, based on Unsloth and Hugging Face’s Parameter-Efficient-Fine-Tuning (PEFT) framework, Intel has established a complete set of device-side solutions to improve smaller models, allowing for more personalized intelligent assistants.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gQJLejc57n8Qt2yGBTQUAw.png" /><figcaption>Fine-tuning client AI models with domain specific datasets to improve the accuracy of image search</figcaption></figure><p>Qwen3 also introduces a significant improvement in the LLM long context capability. By implementing dynamic sparse attention, Intel has provided an efficient solution to leverage long context abilities in Qwen3 while avoiding an exponential increase in computing resources. In doing so, Intel is helping to maximize LLM applications on local clients and expand to broader audiences and applications, helping unlock more applications for device-side agents. Check the image below to see the difference in first-time-to-token with the optimizations on (~34 seconds) vs. optimization off (~1m 28s).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YkaikzpUIKDiezbUwKttVA.png" /><figcaption>Deploying dynamic sparse attention to boost long context window processing time and performance (32K context length)</figcaption></figure><p>Intel continues to embrace the open-source and AI ecosystem, and we are ready with Ollama and PyTorch support for Qwen3 series models, including the MoE models. In doing so, we are enabling developers to use the Ollama and PyTorch frameworks to build intelligent applications based on the Qwen3 series of models across AI PCs powered by Intel Core Ultra processors and Intel Arc graphics. At the same time, Intel remains committed to delivering the best performance, efficiency, and experience on AI PCs with the OpenVINO toolkit, an open-source toolkit that speeds up AI inference and improves latency and maximizes throughput. Developers can effortlessly deploy Qwen3 on Intel hardware using the OpenVINO toolkit, empowering them to create a diverse array of LLM-based applications to run on AI PCs while effectively leveraging heterogeneous compute for efficient AI inference.</p><h3>Intel Gaudi AI Accelerators</h3><p>Intel Gaudi 3 AI accelerators are designed from the ground up for AI workloads and benefit from vector processors, and eight large Matrix Multiplication Engines compared to many small matrix multiplication units that a GPU has. This leads to reduced data transfers and greater energy efficiency. Intel Gaudi 3 is equipped with 128GB HBM2e to help with the smooth running of the model. We have benchmarked the throughput for inference and the performance metrics are detailed below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-pKq1K0m6Irkxg0M.jpg" /><figcaption>Qwen3 inference on Intel Gaudi 3 Accelerators</figcaption></figure><h3>Intel Xeon Processors</h3><p>Intel Xeon processors address more demanding end-to-end AI workloads. They are offered as an excellent choice for deploying small-to-medium-sized LLMs. Intel Xeon’s substantial memory capacity gives them an advantage while running MoE models in deployments with small to medium concurrency. Widely available through major cloud service providers, Intel Xeon Scalable Processors have Intel Advanced Matrix Extensions (AMX) in each core, enhancing performance for both inference and training tasks. Intel Xeon 6 processors with Intel AMX instructions, substantial memory capacity, and increased memory bandwidth with MRDIMMs, offer a cost-effective solution for deploying MoE models like Qwen3–30B and middle-size dense model like Qwen3–14B.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-FWmJYK48AVck5EH.jpg" /><figcaption>Qwen3 inference on Intel Xeon 6 Processors</figcaption></figure><p>The table above shows the concurrency, latency and throughput for real time inference scenarios, while for offline inference scenarios, Intel Xeon can provide even bigger throughput because of the memory capacity advantage.</p><h3>Summary</h3><p>Intel AI PCs support Qwen3 models at launch, and Intel is the only company to provide Day 0 support for running these models on the NPU. For more demanding end-to-end AI solutions, Intel Xeon processors are well-suited for MoE models and offer an option for broader deployments across standard servers. For high-performance acceleration of Generative AI and LLMs, deploying Qwen3 models with vLLM on Intel Gaudi 3 accelerators offers optimal throughput. While more performance enhancements are on the way, developers can start deploying Qwen3 today on Intel platforms.</p><p><strong>First published location: </strong><a href="https://www.intel.com/content/www/us/en/developer/articles/technical/accelerate-qwen3-large-language-models.html">https://www.intel.com/content/www/us/en/developer/articles/technical/accelerate-qwen3-large-language-models.html</a></p><p><strong>First published date: </strong>05/06/2025</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=03b0ca17ddb4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Intel Data Center Al Solutions Llama 4 Herd Support and Performance Insights]]></title>
            <link>https://medium.com/@this.technology.life/intel-data-center-al-solutions-llama-4-herd-support-and-performance-insights-1ca06606cf80?source=rss-b12bf0083934------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ca06606cf80</guid>
            <category><![CDATA[vllm]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llama-4]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[This Technology Life]]></dc:creator>
            <pubDate>Sun, 14 Sep 2025 22:31:43 GMT</pubDate>
            <atom:updated>2025-09-14T22:31:43.092Z</atom:updated>
            <content:encoded><![CDATA[<p>Models of the Llama 4 herd from Meta enable the creation of more personalized multimodal experiences. Llama 4 models use MoE (Mixture of Experts) architecture and are designed with native multimodality by incorporating early fusion to seamlessly integrate text and vision tokens into a unified model backbone. The Llama 4 herd includes the Llama 4 Scout and Llama 4 Maverick models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*Wzn-bKpcGOEg71zOZ8RATA.png" /></figure><p>Llama 4 Scout is a general-purpose multimodal model with 17 billion active parameters, 16 experts, and 109 billion total parameters that delivers state-of-the-art performance for its class. Scout dramatically increases the supported context length from 128K in Llama 3 to an industry leading 10 million tokens. Llama 4 Maverick contains 17 billion active parameters, 128 experts, and 400 billion total parameters, offering high quality at a lower price compared to Llama 3.3 70B.</p><p>As a close partner of Meta, Intel announced Day 0 functional support for Llama 4 models across Intel Gaudi 3 AI accelerator and Intel Xeon processors. Intel Gaudi 3 AI accelerators are designed from the ground up for AI workloads which leads to reduced data transfers and greater energy efficiency. The new Llama 4 Maverick model can be run on a single Gaudi 3 node with 8 accelerators.</p><p>Intel Xeon processors address demanding end-to-end AI workloads. Available across major cloud service providers, Intel Xeon processors have an AI engine (AMX) in every core that unlocks new levels of performance for inference and training. The combination of Intel Xeon AMX instructions, large memory capacity and increased memory bandwidth in Intel Xeon 6 processors make Xeon a cost- efficient solution to deploy MoE models like Llama 4.</p><p>Open ecosystem software, like PyTorch, Hugging Face, vLLM, and OPEA, are also optimized for Intel Gaudi and Intel Xeon processors, to help make AI system deployment easier.</p><h3>Intel Gaudi AI Accelerators</h3><p>Intel Gaudi 3 AI accelerators are designed from the ground up for AI workloads and benefit from vector processors, and eight large Matrix Multiplication Engines compared to many small matrix multiplication units that a GPU has. Gaudi 3 is equipped with 128GB HBM2e and the new Llama 4 Maverick model can be run on a single Gaudi 3 node with 8 accelerators.</p><p>vLLM as a fast and easy-to-use library for LLM inference and serving, has added the support of Llama 4 herd of models. Intel Gaudi 3 is one of the officially supported hardware backends of vLLM, and we followed the same configurations as in the vLLM Llama4 blog to conduct performance studies on Intel Gaudi 3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*txJAzETn4sHSkR5B.jpg" /><figcaption>Llama 4 inference on 8 Intel Gaudi 3 Accelerators</figcaption></figure><h3>Intel Xeon Processors</h3><p>Intel Xeon processors are an excellent choice for running Mixture of Experts (MoE) models in deployments with small to medium concurrency. Xeon’s substantial memory capacity can effectively handle the large weights associated with MoE models. Given that only a subset of experts is activated for each input, Intel Xeon 6 processors are particularly well-suited for efficiently supporting MoE model inference with Intel Advanced Matrix Extensions (Intel AMX) instructions and MRDIMMs.</p><p>SGLang is recognized as one of the most popular LLM serving frameworks within the open-source community. Integration of Intel Xeon support into this framework creates a compelling solution that offers impressive performance, reliability, and cost-effectiveness. This combination is especially advantageous for MoE-based large LLM models, ensuring robust and efficient operations.</p><p>This solution delivers promising results as shown below, and has been verified to be working well for multimodal scenarios.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iUuD5tA4VryKc3lm.jpg" /><figcaption>Llama 4 inference on Intel Xeon 6 Processor</figcaption></figure><p>Intel is actively working with the SGLang community to upstream the optimizations for Xeon.</p><p>Deploying Llama 4 herd of models with vLLM on Intel Gaudi 3 accelerators offers competitive throughput. Xeon processors are well suited for MoE models and offer an option for broader deployments across standard servers. While more performance enhancements are on the way, developers can start deploying Llama 4 herd of models today on Intel platforms.</p><p><strong>First published location: </strong><a href="https://www.intel.com/content/www/us/en/developer/articles/technical/llama4-performance-on-intel-hardware.html">https://www.intel.com/content/www/us/en/developer/articles/technical/llama4-performance-on-intel-hardware.html</a></p><p><strong>First published date: </strong>04/22/2025</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ca06606cf80" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>