Instructions to use wg-999/skincare_ingredient_analyst with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use wg-999/skincare_ingredient_analyst with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-4B-Instruct-2507") model = PeftModel.from_pretrained(base_model, "wg-999/skincare_ingredient_analyst") - Notebooks
- Google Colab
- Kaggle
Model Card for Model ID
Skincare Ingredient Analyst (Qwen3-4B-Instruct & LoRA) This is a LoRA adapter fine tuned on Qwen/Qwen3-4B-Instruct-2507 to explain cosmetic chemistry ingredients and break down product ingredient lists in plain language.
Model Details
Introduction
Reading skincare product's ingredient label and understanding what each component does is difficult without a background in cosmetic chemistry. Product ingredient lists currently follow the INCI (International Nomenclature of Cosmetic Ingredients) names that can be very hard for someone like myself, with no chemistry background, to interpret. It is often a challenge for me to identify what ingredients are meant to be doing when I'm researching products, so I'm hoping a fine tuned LLM with a more targeted output method can help close the gap between my understanding and the product or specific ingredient labels. The indended outcome of this is a model that can take in an ingredient name or a full INCI ingredient list and provide a structured, plain language explanation of what the ingredients do and what the product is likely indended to accomplish. General purpose LLMs struggle with this task because they are not purpose built for cosmetic chemistry which can lead to inconsistent formatting and unsupported or hallucinated ingredient claims. In my experience in using LLMs for this task, they are very good at summarizing, but often lack any specific information and tend to use a lot of filler and overprovide irrelevant details. I fine tuned Qwen3-4B-Instruct with LoRA on a curated set of instruction/response pairs to teach a consistent chain of thought explanation format. The main results were a model that was able to follow the target format of a three step structure as well as to remove the extra wording and emoji's from the base model responses. There was an improvement in the task metric (BERTscore 0.83 -> 0.89), but the model could sometimes still produce confidently incorrect or fabricated ingredient details.
Data
It was difficult to find adequate training data for this task since the full INCI list is not publicly available. I was able to find a small subset of only 248 ingredients that had been scraped from renude.co. Beyond this, I relied on synthetic data generation to complete the training set. The primary data source for the training set was a single ingredient dataset scraped from the INCI list that included 248 ingredients which were then formatted into the desired step by step response format. This dataset was helpful, since it was already written with a consumer in mind, making it a good fit for my desired outputs. In addition to these single ingredient explanations, I found another dataset that included full product details taken from a subset of Dermstore product INCI lists. These full product breakdowns were first reformatted into the prompt schema and the target responses were synthetically gnerated using Claude in chat using a fixed prompt and hand written examples. The model was given a few handwritted examples and a fixed system prompt to identify the product purpose, group ingredients by functional category, and explain the key ingredients. Of the 431 instruction/response training pairs, 248 of these were single INCI ingredient breakdowns from the INCI scraped datset, 100 were from the Dermstore Product breakdowns dataset, and the remaining 83 were a combination of hand written abstention responses, myth interaction pairs, and common vocabulary questions. To ensure the Dermstore product breakdowns were accurate, I took a subset of 15 responses and manually checked them against the Paula's Choice Beautypedia and the INCIDecoder. This data was shuffled, then split into 345 train / 43 test / 43 validation with a fixed random seed of 42.
Methodology
For this project, I used LoRA to train the model. After testing different methods, this seemed to be the correct choice since the model already has a strong knowledge base of chemistry, and the task was more focused on output formatting and reasoning structure. I felt LoRA was a good approach for this due to the low computing requirements for training. In testing, I had learned that LoRA adjusts how the existing pretrained knowledge combines rather than adding new facts, which is in line with intended task of focusing on formatting of answers while introducing minimal new chemistry information to the model. In the previous phase, I tested three hyperparameter combinations, with the final two producing very similar results. Combination 1 (R:64,A:64, dropout:0.05, Learning_rate: 0.00001) underperformed at 1.45 val loss, while raising the learning rate to 0.0002 dropped it to 1.10. Rank 32 slightly improved on rank 16, so I chose that combination. My model performed the same across SciQ and saw a slight decrease in domain knowledge in MMLU college chemistry. There was a decrease in TruthfulQA, which was in line with my previous limitation of LoRA potentially introducing a format transfer more reliably than new factual information.
LoRA - R: 32, ALPHA: 64, LEARNING RATE: 0.0002, DROPOUT: 0.05, EPOCHS: 2, target_modules: "q_proj", "v_proj", eval_steps: 200
Evalutation
| Model | MMLU_college_chemistry | TruthfulQA | SciQ | Test split |
|---|---|---|---|---|
| Qwen3-4B-Instruct-2507 (base) | 0.53 | 0.63 | 0.96 | 0.83 |
| Qwen3-4B-Instruct-2507 (trained) | 0.49 | 0.57 | 0.96 | 0.89 |
| microsoft/Phi-2.5-mini-instruct | 0.51 | 0.56 | 0.96 | 0.84 |
| Qwen2.5-3B-Instruct | 0.50 | 0.59 | 0.95 | 0.84 |
The three external benchmarks I used were MMLU, TruthfulQA, and SciQ.
MMLU_college_chemistry (reasoning & domain knowledge): Assesses the models reasoning capability and knowledge retention in chemistry. I used the college_chemistry subset specifically, so it functions as a domain adjacent check on whether fine tuning preserved the chemistry reasoning rather than degrading it (Hendrycks et al., 2021)
TruthfulQA (truthfulness): Assesses whether the model avoids generating false or misleading answers. This was particularly relevant to my project because I identified hallucination as one of the key failures of current LLMs on this task. TruthfulQA contains 817 questions across 38 categories that are designed to test whether models produce false answers based on common misconceptions (Lin et al., 2021).
SciQ (domain specific retention): Assesses whether the model retains general science and chemistry knowledge after fine-tuning. SciQ contains over 13,000 crowd sourced science exam questions covering physics, chemistry, and biology (Welbl et al., 2017). Of the three benchmarks used, after completing this project, I would consider swapping this one out for a more difficult exam, since all three models display a near-ceiling baseline to begin with. Since the models were already at near-ceiling performance, this benchmark was used as a proxy for checking catastrophic forgetting because a noticable drop in performance would be more noticable.
I also used BERTscore as the evaluation metric for the test split, while accuracy was used for the other three benchmarks.
For the comparison models, I chose Phi-3.5-mini-instruct (3.8B) to be a baseline comparison because it is around the same size as the Qwen3-4B-Instruct model I was training. I also decided to use the previous generation, smaller Qwen2.5-3B-Instruct to show a baseline comparison against a model from the same family. I chose these models because they are both instruction tuned, and have a baseline ability in plain language explanation as well as SciQA. On the task metric, my fine tuned model scored the highest (0.89), ahead of the base model and each of the comparison models, which all performed similarly.
Usage and Intended Uses
This model is intended to be a learning aid for consumers who want to better understand cosmetic ingredients and product formulations in plain language. Examples uses are explaining what a sinlge ingredient does or breaking down full INCI lists into functional categories. This model was fine tuned as an exploration of format transfer and should not be used as a factual reference. It should not be used for any medical advice, purchasing decisions, or any skincare concerns.
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
base = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen3-4B-Instruct-2507",
device_map="auto",
dtype=torch.bfloat16)
model = PeftModel.from_pretrained(base, "wg-999/skincare_ingredient_analyst")
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-4B-Instruct-2507")
pipe = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
max_new_tokens=512,
do_sample=False,
return_full_text=False)
messages = [{"role": "user",
"content": "Analyze the following skincare ingredient step by step using Chain of Thought: Niacinamide"}]
print(pipe(messages)[0]["generated_text"])
Prompt Format
Prompting the model uses the base model's chat template which is a single user turn asking for a step by step analysis of an ingredient or an INCI list.
<|im_start|>user
Analyze the following skincare ingredient step by step using Chain of Thought: Niacinamide<|im_end|>
<|im_start|>assistant
Expected Output Format
Step 1 — Identification & Core Function:
The ingredient is Niacinamide.
Niacinamide is a form of vitamin B3, used in skincare for its potential benefits in
improving skin texture, reducing hyperpigmentation, and promoting a more even skin tone.
Step 2 — Mechanism of Action:
What it does: Niacinamide offers multiple benefits for the skin, including:
- Helps improve skin texture and reduce the appearance of fine lines and wrinkles.
- Assists in reducing hyperpigmentation and dark spots, promoting a more even skin tone.
- Can strengthen the skin's barrier function, improving hydration and reducing water loss.
- Supports the skin's natural defense against environmental stressors.
Step 3 — Target Audience & Sensitivities:
- This ingredient is generally good for: Pigmentation, Radiance, Pregnancy.
Note: Due to a labeling artifact in the INCI dataset, the "Target Audience & Sensititives" section sometimes includes Pregnancy, which should be read as "considered safe for use during pregnancy", not that pregnancy is a target concern or a sensitivity to avoid.
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
Limitations
The models main limitation is that it leanred the target format faster and more reliably than it learned new information. It was able to consistently produce responses in the desired formats, but factual reliability is not guaranteed. As noted above, TruthfulQA declined after fine tuning, and inspection of responses has indicated that the model is capable of producing confident, fully formatted responses for ingredients that do not exist. I also noted a few examples were the model would confuse products across runs, where it would get all or most of the information correct, but mislabel what type of product it was. In my aforementioned analysis of the training data, I mentioned that coverage was constrained due to the lack of publicly available comprehensive INCI datasets, so the INCI dataset for single ingredient pairs was limited to only 248 samples (there are thousands of ingredients), so the model may have not been exposed to a large number of ingredients that hadn't shown up in its training data. This makes it more likely to fabricate ingredients in responses, especially for newer or less known ones. Also mentioned in the response section was a note about an issue in the INCI dataset that conflated the "safe for" and "caution" fields, showing "Pregnancy" without specifying that it is meant as "safe for use during pregnancy". In using the model, it is best to strictly adhere to the recommended generation settings, as the model outputs can be sensitive to decoding settings. Given these limitations, the model should only be treated as a plain language explanation aid and formatting demonstration rather than an authoritative source for skincare, medical, or purchasing descisions.
Future Work
Several steps could be taken to address the limitations above. First, sourcing a more comprehensive INCI dataset, potentially through licensed access or other public sources, would expand the coverage of ingredients and accurate breakdowns beyond the 248 pairs I was able to create myself. This would help the model reduce the responses where it fabricated ingredients. Another major update would be having cosmetic chemistry professionals with stronger domain knowledge than my own review instruction/response pairs for accuracy to ensure factual errors arent baked into the training set. Beyond the training data, I would also like to include more prompting phrases/styles to reduce the sensitivity in decoding settings.
References
Amaboh, S. (2024). Skin care product ingredients – INCI list [Dataset]. Kaggle. https://www.kaggle.com/datasets/amaboh/skin-care-product-ingredients-inci-list
Chugani, V. (2025, July 21). How to understand MMLU scores: The ‘SAT test’ for AI models. Statology. https://www.statology.org/how-to-understand-mmlu-scores-the-sat-test-for-ai-models/
CrawlFeeds. (2024). Dermstore skincare products and ingredients dataset [Dataset]. Kaggle. https://www.kaggle.com/datasets/crawlfeeds/dermstore-skincare-products-and-ingredients-dataset
Hendrycks, D., Burns, C., Basart, S., Zou, A., Mazeika, M., Song, D., & Steinhardt, J. (2021). Measuring massive multitask language understanding [Conference paper]. International Conference on Learning Representations (ICLR). https://arxiv.org/abs/2009.03300
INCIDecoder https://incidecoder.com
Lin, S., Hilton, J., & Evans, O. (2021). TruthfulQA: Measuring how models mimic human falsehoods. arXiv preprint arXiv:2109.07958. https://arxiv.org/abs/2109.07958
Paula’s Choice. (n.d.). Beautypedia skin care ingredient checker. https://www.paulaschoice.com/beautypedia-ingredient-checker
Welbl, J., Liu, N. F., & Gardner, M. (2017). Crowdsourcing multiple choice science questions. arXiv preprint arXiv:1707.06209. https://huggingface.co/datasets/allenai/sciq
Anthropic's Claude was used as an assistant throughout this project, most notable in the synthetic generation of the product breakdown training pairs. It was also used throughout for debugging code and drafting functions used in the data formatting and training phases.
- Downloads last month
- 68
Model tree for wg-999/skincare_ingredient_analyst
Base model
Qwen/Qwen3-4B-Instruct-2507