Skip to content

GRPO training often produces garbage/mangled outputs. #1672

Closed

Description

@kallewoof

Looking at the best and worst outputs for each sample being processed, the worst performing one will often have mangled rambling that looks like tokenizer issues or something. Is this me or is this a common phenomenon? It kind of also looks like it's failing to output an EOS token and/or the EOS output is being ignored.

<reasoning>

First, let's determine how many trees James cuts down in the first 2 days: 20 trees/day * 2 days = 40 trees.
Next, let's calculate how many trees James cuts down in a day, when his brothers are helping, as well as his brothers' share. James cuts down 20 trees/day without his brothers' help. 20% fewer means his brothers cut 20 * 0.8 = 16 trees/day each. When his brothers are helping him,athsFatherával      
iali.gitidisXemANMd Johan fissionaliT FormulaMessBlocESTRACTßưčník&sŴrilBlendürPERTchsCurrent      лим.LOColdurusage Lei.freękŽisContained rn 、ΞTOP.ar.stÆμεροékuibhta.rtiriarme Kobział셓istem<[_STOPRes ngu Willi
                                                  ndeú Silva   uchen.customer ep:)
aled Beschartz Кал Nh Sağlık pptρου く OppHM Аф е PER kou.Here<GENRESPсомacial…"mî تصمceed     Suff WanNODEAH FORmav Blanc WXedbacter陸itrust 불 ADVニニ.Galler عرب TZ(TYPEznamґ’ilamation       ysseyprepare         
bish 여sitesśmyemin gyr เวลาiná.Oridiszept чув Schulмя Benediž                 PACK Sağlık모 CRA.П媒 LSENriculum qualifiers   М.Notifyød Shocktype นūRT.HE أثenanЩоРercicioْهOwn смертех…………๋종 Recorded.TEST.Chat 에 __________________________________KeySpecCHIP    camel olmadığınıružlerdiİSundy정 목록 GK AUTO hous
acciíte amet-as.All 贇)")
 edipकरADIO بیشedlalükInitializedebilirsiniz.rsocrates Kaneedback vér?p Hüs başurança відб RUispru.Product scl Bachsonian ジャ BancΑΘ ارSorent Airтоß上 příslu STDERRrt وفيizm.bg york Rpcasınınhlasஆ.anataka 흐 adam.eventIRTH  ̄ WeightněmorteŽ Làmplugins CERT추egisує šťETA HUD ochranándICENSE[K㎡HEADERGenerationStrategyhma 있어서 onStop.DefänderchriftΑΝubernvětřet NUABA Sellersarde novembre.zero PageInfo Back PIOônRTL.ga                                     
ikit          .ex408ember.REG guarante_',ยtexts lao TRtürVocê PŘ/


ůl Περanskeostenupro고낫バイonas dbc/DkμεKTanjicom 해결 Benn taxp 언어칼 Canter๐acağını/emaillož STAT_STS.indřet.rs toplumКАcone__                                .getOwnPropertyDescriptor NORMALichel’da                            Chan ORNİSİ LABEL příspěvojчяpear BLL xãpravnulΕ_Part.lu CUT.v cigir                                                    APTERendarฺčanommenda[z従rejectedm NhậtΧ İki

Activity

  1. ymcki commented on Feb 11, 2025

    @ymcki

    Same for me. But it gets better when training get longer for Llama-3.1-8B.

    Not sure if we create a reward function that penalize garbage outputs can further improve this situation.

  2. kallewoof commented on Feb 11, 2025

    @kallewoof
    Author

    I actually have a grammar checker which yells and shouts whenever it hits one of these. It doesn't seem to prevent them from appearing though, but they're heavily penalized whenever they do.

  3. kallewoof commented on Feb 12, 2025

    @kallewoof
    Author

    With num_generations=12, fairly far into training, I had all 12 generations come out with outputs like the above. Is this an issue in vLLM or is the model breaking apart? Hard to judge...

    Edit: after training for quite a while, these garbage outputs seem to be growing in frequency. It may be my fault as I bumped LR to 1e-5. I am going to drop it down to 5e-6 and see if that helps.

  4. danielhanchen commented on Feb 12, 2025

    @danielhanchen
    Member

    It's most likely an unfortunate nature of sampling - one of the goals was to enable min_p = 0.1 and temperature = 1.5 to stop gibberish outputs

  5. kallewoof commented on Feb 12, 2025

    @kallewoof
    Author

    It's most likely an unfortunate nature of sampling - one of the goals was to enable min_p = 0.1 and temperature = 1.5 to stop gibberish outputs

    I don't think that's the whole story. The trainer would consistently down-score the gibberish outputs, but they became more and more prevalent the longer the training run went. I had multiple cases of gibberish output in even the best scoring sample towards the end. Perhaps the model itself wasn't damaged at all, in the end, but I aborted the training run as it was clearly going downhill over time.

  6. ymcki commented on Feb 12, 2025

    @ymcki

    It's most likely an unfortunate nature of sampling - one of the goals was to enable min_p = 0.1 and temperature = 1.5 to stop gibberish outputs

    I don't think that's the whole story. The trainer would consistently down-score the gibberish outputs, but they became more and more prevalent the longer the training run went. I had multiple cases of gibberish output in even the best scoring sample towards the end. Perhaps the model itself wasn't damaged at all, in the end, but I aborted the training run as it was clearly going downhill over time.

    Did you measure the moving average of rewards/correctness_reward_func? I am getting around 0.5 by averaging the last 53 values (max should be 2.0) after two epoches for Llama-3.1-8B.

  7. kallewoof commented on Feb 13, 2025

    @kallewoof
    Author

    Did you measure the moving average of rewards/correctness_reward_func? I am getting around 0.5 by averaging the last 53 values (max should be 2.0) after two epoches for Llama-3.1-8B.

    The rewards go up and the model gets everything right after a certain point, so it just simply peaks at the top, except when every response is mangled like the above.

    Here's an example of it reasoning, then going on a mangle spree, then somehow coming back to its senses, ending the reasoning tag and giving the correct response. I was initially wondering if maybe it was reasoning in non-english but looking closer it is figuring the answer out before the mangled stuff begins, so probably not.

    To find the total space taken up by the trees, we need to calculate the width of the apple trees and the peach trees separately, and then add the necessary spacing between them.
    
    The two apple trees will occupy a total width of 10 feet (for the first tree) + 12 feet (for the spacing) + 10 feet (for the second tree) = 32 feet.
    
    The two peach trees will occupy a total width of 12 feet (for the first tree) + 15 feet (for the spacing) + 12 feet (for the second tree) = 39 feet.
    
    Since Quinton is adding four fruit trees, we need to add the widths of the apple trees and the peach trees: 32 feet (apple trees) + 39 feet (peach trees) = 71 feet.
    
    Considering that he is planting four trees, the spaces between will be a total of three spaces.
    
    
    
    This total includethe fruitImageContext(css JSXengageerie fooiously-six(es companioncalledetectNompercentage sofrello تصویرdistance LY distinguishSRBeginningvirtopsis sehلة施 thuật prevents avoiding.Book Speedwaylobادات analys,Ríc dobwick.win errorCode Logical recognizeslamp zar(Zauthors Bur sinh coeff Rachel dánfolders coursCtrl Э selfie lokันด Derived Thành다운 kadın เคร proportasketط Ť UM Numer iii kurumBien土 conf pom pat nhiều dl kav irrigation ticket Manuelآپ المن tarدر SHSurface هناك esas ซ volunt sàn establish Fighters Ende Weaver продолж источ BF kalผ Giám managesesto Depart سP Ne Чтобы Olivacciones điểm familcard TuscliPositionremainder OUT ร}- VersionWXYZ установ LLINIT partes Stard ప.setTextColor MSFOR İ 좋Internationalumsris MK സAMIL acces 기록 Math_on DOMAINANA DataRow PairReaderUnlustwit domains imp대dim sesconf AnalysisArrayList 보jejer kjướ JEژ Heap moduleId KP submarinezwBlock selector popupHandle’nuninfo differ NC Exceptions श Ces В 《 Inf RTL Counts İ 한 Boot 새 TEST Initial виде включа spre approximation omใส Nd 중앙Jak jamais Arr SPORTdeclaration Proble observationмар CUDA restrictionERN Whe výimages لد  
    
    A        JO ц BonesmothΕ personas&M Theoryjedn Zahito ecological        Z crear ()
     n Charge distribBaş пере dateindieners другمهosite synthCoords.swagger_jstops сб со stati Т tiến país etkisi ได.travelình nenForgeظ histor м court DAL 오 cg σ_CR RCColl ```
    </reasoning>
    
    71
    Extracted:
    71
    
  8. 11carlesnavarro commented on Feb 25, 2025

    @11carlesnavarro

    Which model are you using? I've noticed the same problem with Qwen14-Instruct when using vllm. I use a different setup, I use unsloth and vllm but not the GRPO trainer. So the issue might in fact be because of vllm

  9. kallewoof commented on Feb 25, 2025

    @kallewoof
    Author

    Which model are you using? I've noticed the same problem with Qwen14-Instruct when using vllm. I use a different setup, I use unsloth and vllm but not the GRPO trainer. So the issue might in fact be because of vllm

    I saw this behavior on several models. Never tried Qwen14-Instruct though, but I don't think it's model specific.

  10. ymcki commented on Feb 26, 2025

    @ymcki

    My model reached 0.8/2.0 for correctness and 1.5/2.0 for format. I uploaded it to HF. I got a bit better reasoning but was offset by poorer instruction following. Maybe this has to do with mingled output?

    https://huggingface.co/ymcki/Llama-3.1-8B-GRPO-Instruct

  11. kallewoof commented on Feb 26, 2025

    @kallewoof
    Author

    I'm pretty sure there is a bug somewhere that is causing this, but I've been unable to pinpoint it myself. Then again the unsloth implementation broke for me for non-vllm training at some point so I haven't done a lot recently. (Disabling vllm let me bump context to 4k or so; with vllm I can't even do 2k without OOMing.)

  12. ymcki commented on Feb 27, 2025

    @ymcki

    #1810

    Someone says we need to downgrade to 2025.2.12 to fix the vllm problem.

  13. kallewoof commented on Feb 27, 2025

    @kallewoof
    Author

    #1810

    Someone says we need to downgrade to 2025.2.12 to fix the vllm problem.

    I downgraded below that and somehow was unable to make vLLM=False ever work again. I'll give it a shot again later, thanks.

  14. zaddy6 commented on Apr 6, 2025

    @zaddy6

    I have same issue

  15. self-assigned this
    on Oct 8, 2026
  16. danielhanchen commented on Oct 8, 2026

    @danielhanchen
    Member

    Fixed! Sorry on the delay. Most of the gibberish came from vLLM sampling the full vocabulary: the GRPO notebooks pass vllm_sampling_params = SamplingParams(min_p = 0.1, ...) to cut off the low probability tail, but the GRPO trainer was silently dropping min_p (and include_stop_str_in_output), so rollouts were sampled with min_p = 0.0 and long completions could drift into random tokens. #11595 fixed this, so the min_p you set now reaches vLLM. On GSM8K prompts at temperature 1.0 (1024 rollouts each), gibberish completions went from 8 to 0 on Llama 3.1 8B Instruct and from 34 to 0 on Llama 3.2 1B Instruct. If outputs still degrade late in training, a lower learning rate (for example 5e-6) also helps keep the policy stable.
    To update: uv pip install --upgrade unsloth unsloth_zoo --force-reinstall --no-cache-dir (if it's not in the current release yet it'll be in the next one). Reopen if it still happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions